Skip to content

Commit

Permalink
Merge pull request #317 from jamezp/LOGMGR-279-2.1
Browse files Browse the repository at this point in the history
[LOGMGR-279] Retrieve the handler reference before it may be potentia…
  • Loading branch information
jamezp authored Jun 23, 2020
2 parents c19646b + 3dbb5cc commit c3f70a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,19 +375,20 @@ public boolean removeHandlerName(final String name) {
}
final int index = handlerNames.indexOf(name);
handlerNames.remove(index);
configuration.addAction(new ConfigAction<Void>() {
public Void validate() throws IllegalArgumentException {
return null;
configuration.addAction(new ConfigAction<Handler>() {
public Handler validate() throws IllegalArgumentException {
final Map<String, Handler> handlerRefs = configuration.getHandlerRefs();
return handlerRefs.get(name);
}

public void applyPreCreate(final Void param) {
public void applyPreCreate(final Handler param) {
addPostConfigurationActions();
}

public void applyPostCreate(final Void param) {
public void applyPostCreate(final Handler param) {
final Map<String, Handler> handlerRefs = configuration.getHandlerRefs();
final ExtHandler handler = (ExtHandler) handlerRefs.get(getName());
handler.removeHandler(handlerRefs.get(name));
handler.removeHandler(param);
}

public void rollback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,19 @@ public boolean removeHandlerName(final String name) {
}
final int index = handlerNames.indexOf(name);
handlerNames.remove(index);
configuration.addAction(new ConfigAction<Void>() {
public Void validate() throws IllegalArgumentException {
return null;
configuration.addAction(new ConfigAction<Handler>() {
public Handler validate() throws IllegalArgumentException {
final Map<String, Handler> handlerRefs = configuration.getHandlerRefs();
return handlerRefs.get(name);
}

public void applyPreCreate(final Void param) {
public void applyPreCreate(final Handler param) {
}

public void applyPostCreate(final Void param) {
final Map<String, Handler> handlerRefs = configuration.getHandlerRefs();
public void applyPostCreate(final Handler param) {
final Map<String, Logger> loggerRefs = configuration.getLoggerRefs();
final Logger logger = (Logger) loggerRefs.get(getName());
logger.removeHandler(handlerRefs.get(name));
final Logger logger = loggerRefs.get(getName());
logger.removeHandler(param);
}

public void rollback() {
Expand Down

0 comments on commit c3f70a6

Please sign in to comment.