-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable some asynchronous logging (revised) #49
base: master
Are you sure you want to change the base?
Conversation
@@ -80,6 +81,30 @@ public synchronized FluentLogger getLogger(String tagPrefix, String host, int po | |||
return logger; | |||
} | |||
|
|||
public FluentLogger getLogger(String tagPrefix, String host, int port, int timeout, int bufferCapacity, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that this method worthiness, for now....
Why does this feature make no progress anymore? |
This feature is implemented in Fluency. |
@cosmo0920 Oh really sorry, I failed to notice the notifications of this project. Let me see the changes. |
@@ -33,7 +34,7 @@ | |||
private final Map<FluentLogger, String> loggers; | |||
|
|||
public FluentLoggerFactory() { | |||
loggers = new WeakHashMap<FluentLogger, String>(); | |||
loggers = Collections.synchronizedMap(new WeakHashMap<FluentLogger, String>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't seem to be related to asynchronous logging.
@cosmo0920 @mxk1235 Thanks for the PRs! I left some comments. Also, it needs unit tests in principle. BTW, as I commented earlier, AsyncRawSocketSender creates a thread for each invoking |
Thanks for your review! I'll try to resolve issues which are pointed out. |
f63cc3f
to
7cef979
Compare
I fixed some test failures at 969b88d. Could you try |
… wrapper around RawSocketSender
… wrapper around RawSocketSender
containsKey -> containsValue
2d6c3ea
to
10d57db
Compare
Rebased! |
@@ -19,6 +19,7 @@ | |||
|
|||
import java.lang.reflect.Constructor; | |||
import java.lang.reflect.InvocationTargetException; | |||
import java.util.Collections; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import
?
@cosmo0920 Thanks! I left some comments on the diff. Especially, https://github.com/fluent/fluent-logger-java/pull/49/files#r61833474 is an issue, I think. BTW, will you actually use AsyncRawSocketSender? If so, what do you think about creating an EmitRunnable for each |
* Added normal cases for now.
10d57db
to
7392010
Compare
No, I won't.
I've added this one in javadoc comment. |
return this.isConnected() || reconnector.enableReconnection(System.currentTimeMillis()); | ||
try { | ||
Future<Boolean> result = senderTask.submit(new EmitRunnable(tag, data, sender, timestamp)); | ||
return result.get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, Future#get
will wait the result here. So this method doesn't work asynchronously...
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html#get--
@cosmo0920 Sorry for late reply again. Could you check this comment? 1bf11d7#r65201214 |
1bf11d7
to
046b798
Compare
Revised #30.
And I modified
setErrorHandler/removeErrorHandler
inAsyncRawSocketSender
.Should I add tests for
AsyncRawSocketSender
?