Skip to content

Commit

Permalink
Merge pull request #284 from jamezp/LOGMGR-262
Browse files Browse the repository at this point in the history
[LOGMGR-262] The addCloseHandler and setCloseHandlers methods on the …
  • Loading branch information
jamezp authored Dec 6, 2019
2 parents bfaf68e + daf45d1 commit 37a099f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/main/java/org/jboss/logmanager/LogContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ public Enumeration<String> getLoggerNames() {
* @param closeHandler the close handler to use
*/
public void addCloseHandler(final AutoCloseable closeHandler) {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(CONTROL_PERMISSION);
}
synchronized (treeLock) {
closeHandlers.add(closeHandler);
}
Expand Down Expand Up @@ -583,6 +587,10 @@ public Set<AutoCloseable> getCloseHandlers() {
* @param closeHandlers the close handlers to use
*/
public void setCloseHandlers(final Collection<AutoCloseable> closeHandlers) {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(CONTROL_PERMISSION);
}
synchronized (treeLock) {
this.closeHandlers.clear();
this.closeHandlers.addAll(closeHandlers);
Expand Down

0 comments on commit 37a099f

Please sign in to comment.