-
Notifications
You must be signed in to change notification settings - Fork 109
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
[LOGMGR-177] Add a new DelayedHandler which will queue messages until… #164
[LOGMGR-177] Add a new DelayedHandler which will queue messages until… #164
Conversation
private final Deque<ExtLogRecord> logRecords = new ArrayDeque<>(); | ||
|
||
private volatile boolean activated = false; | ||
private volatile int callerCalculationState = -1; |
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 could just be a volatile boolean forceCallerCalculation
...
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 thought about that, but then you wouldn't know if it was explicitly set to false
. If explicitly set I want to avoid the super invocation.
* @param value {@code false} to explicitly disable the caller information otherwise {@code false} to always | ||
* ensure the caller information is recorded | ||
*/ | ||
public void setCallerCalculationRequired(final boolean value) { |
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.
forceCallerCalculation = value
} | ||
// It's possible being a delayed handler that this could report a false negative. However since the this can | ||
// manually be overridden it's best to assume we don't want the caller information. | ||
return super.isCallerCalculationRequired(); |
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.
Change this whole method to:
return forceCallerCalculation || super.isCallerCalculationRequired();
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.
IOW we never want to force not calculating the caller, but we also don't want to calculate the caller unless we must.
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.
Okay fair point. I guess that really does make more sense in a case where the formatter may really want the caller information, but the user made a mistake of setting it to false
.
db20976
to
eebd7b8
Compare
… at least one child handler is set.
eebd7b8
to
11e2ec1
Compare
… at least one child handler is set.
https://issues.jboss.org/browse/LOGMGR-177
Simply adds a
DelayedHandler
which will queue messages until a child handler is added. Once added the queue is drained and any log messages published after activation will be directly published to child handlers.