ch.qos.logback.core.spi
Class AppenderAttachableImplLockTest

java.lang.Object
  extended by ch.qos.logback.core.spi.AppenderAttachableImplLockTest

public class AppenderAttachableImplLockTest
extends Object

This test shows the general problem I described in LBCORE-67. In the two test cases below, an appender that throws an OutOfMemoryError while getName is called - but this is just an example to show the general problem. The tests below fail without fixing LBCORE-67 and pass when Joern Huxhorn's patch is applied. Additionally, the following, probably more realistic, situations could happen: -addAppender: appenderList.add() could throw OutOfMemoryError. This could only be shown by using an appenderList mock but appenderList does not (and should not) have a setter. This would leave the write lock locked. -iteratorForAppenders: new ArrayList() could throw an OutOfMemoryError, leaving the read lock locked. I can't imagine a bad situation in isAttached, detachAppender(Appender) or detachAppender(String) but I'd change the code anyway for consistency. I'm also pretty sure that something stupid can happen at any time so it's best to just stick to conventions.

Author:
Joern Huxhorn

Constructor Summary
AppenderAttachableImplLockTest()
           
 
Method Summary
 void detachAppenderBoom()
           
 void getAppenderBoom()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppenderAttachableImplLockTest

public AppenderAttachableImplLockTest()
Method Detail

getAppenderBoom

public void getAppenderBoom()

detachAppenderBoom

public void detachAppenderBoom()
                        throws InterruptedException
Throws:
InterruptedException


Copyright © 2005-2009 QOS.ch. All Rights Reserved.