[ 
http://jira.qos.ch/browse/LBCORE-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11177#action_11177
 ] 

Joern Huxhorn commented on LBCORE-97:
-------------------------------------

Environment:
delay                = 1
java.runtime.name    = Java(TM) 2 Runtime Environment, Standard Edition
java.runtime.version = 1.5.0_16-b06-284
java.vendor          = Apple Inc.
java.version         = 1.5.0_16
java.vm.name         = Java HotSpot(TM) Client VM
java.vm.info         = mixed mode, sharing
os.name              = Mac OS X
os.version           = 10.5.7
os.arch              = i386
##########################################
About to execute usingSynchronized...
Results for usingSynchronized:
runnables[0]: SynchronizedRunnable[counter=9050, running=false, delay=1]
runnables[1]: WastedTimeSynchronizedRunnable[counter=5533, running=false, 
delay=1, minWasted=0, maxWasted=2035000, totalWasted=4307631000]
runnables[2]: WastedTimeSynchronizedRunnable[counter=5564, running=false, 
delay=1, minWasted=0, maxWasted=3340000, totalWasted=4274103000]
runnables[3]: WastedTimeSynchronizedRunnable[counter=5499, running=false, 
delay=1, minWasted=0, maxWasted=2613000, totalWasted=4341686000]
runnables[4]: WastedTimeSynchronizedRunnable[counter=5541, running=false, 
delay=1, minWasted=0, maxWasted=2614000, totalWasted=4298552000]
runnables[5]: WastedTimeSynchronizedRunnable[counter=5580, running=false, 
delay=1, minWasted=0, maxWasted=2115000, totalWasted=4257398000]
runnables[6]: WastedTimeSynchronizedRunnable[counter=5543, running=false, 
delay=1, minWasted=0, maxWasted=3344000, totalWasted=4297607000]
runnables[7]: WastedTimeSynchronizedRunnable[counter=5581, running=false, 
delay=1, minWasted=0, maxWasted=3332000, totalWasted=4254483000]
runnables[8]: WastedTimeSynchronizedRunnable[counter=5570, running=false, 
delay=1, minWasted=0, maxWasted=2118000, totalWasted=4267368000]
runnables[9]: WastedTimeSynchronizedRunnable[counter=5538, running=false, 
delay=1, minWasted=0, maxWasted=2518000, totalWasted=4305538000]
##########################################
About to execute usingUnfairLock...
Results for usingUnfairLock:
runnables[0]: LockRunnable[counter=9655, running=false, delay=1]
runnables[1]: WastedTimeLockRunnable[counter=8, running=false, delay=1, 
minWasted=0, maxWasted=3177612000, totalWasted=9992771000]
runnables[2]: WastedTimeLockRunnable[counter=11, running=false, delay=1, 
minWasted=0, maxWasted=3175541000, totalWasted=9989755000]
runnables[3]: WastedTimeLockRunnable[counter=8, running=false, delay=1, 
minWasted=0, maxWasted=3113132000, totalWasted=9992838000]
runnables[4]: WastedTimeLockRunnable[counter=10, running=false, delay=1, 
minWasted=0, maxWasted=2945695000, totalWasted=9990695000]
runnables[5]: WastedTimeLockRunnable[counter=11, running=false, delay=1, 
minWasted=0, maxWasted=2952869000, totalWasted=9989668000]
runnables[6]: WastedTimeLockRunnable[counter=13, running=false, delay=1, 
minWasted=0, maxWasted=3092394000, totalWasted=9987500000]
runnables[7]: WastedTimeLockRunnable[counter=8, running=false, delay=1, 
minWasted=0, maxWasted=3750551000, totalWasted=9992601000]
runnables[8]: WastedTimeLockRunnable[counter=8, running=false, delay=1, 
minWasted=0, maxWasted=3750598000, totalWasted=9992641000]
runnables[9]: WastedTimeLockRunnable[counter=10, running=false, delay=1, 
minWasted=0, maxWasted=3623426000, totalWasted=9990499000]
##########################################
About to execute usingFairLock...
Results for usingFairLock:
runnables[0]: LockRunnable[counter=8756, running=false, delay=1]
runnables[1]: WastedTimeLockRunnable[counter=8691, running=false, delay=1, 
minWasted=0, maxWasted=1384000, totalWasted=1141561000]
runnables[2]: WastedTimeLockRunnable[counter=8691, running=false, delay=1, 
minWasted=0, maxWasted=1240000, totalWasted=1139965000]
runnables[3]: WastedTimeLockRunnable[counter=8688, running=false, delay=1, 
minWasted=0, maxWasted=1373000, totalWasted=1142592000]
runnables[4]: WastedTimeLockRunnable[counter=8695, running=false, delay=1, 
minWasted=0, maxWasted=1406000, totalWasted=1134775000]
runnables[5]: WastedTimeLockRunnable[counter=8690, running=false, delay=1, 
minWasted=0, maxWasted=1447000, totalWasted=1138803000]
runnables[6]: WastedTimeLockRunnable[counter=8687, running=false, delay=1, 
minWasted=0, maxWasted=2188000, totalWasted=1146588000]
runnables[7]: WastedTimeLockRunnable[counter=8698, running=false, delay=1, 
minWasted=0, maxWasted=1395000, totalWasted=1134743000]
runnables[8]: WastedTimeLockRunnable[counter=8688, running=false, delay=1, 
minWasted=0, maxWasted=1455000, totalWasted=1140360000]
runnables[9]: WastedTimeLockRunnable[counter=8687, running=false, delay=1, 
minWasted=0, maxWasted=1226000, totalWasted=1145801000]
##########################################



Environment:
delay                = 10
java.runtime.name    = Java(TM) 2 Runtime Environment, Standard Edition
java.runtime.version = 1.5.0_16-b06-284
java.vendor          = Apple Inc.
java.version         = 1.5.0_16
java.vm.name         = Java HotSpot(TM) Client VM
java.vm.info         = mixed mode, sharing
os.name              = Mac OS X
os.version           = 10.5.7
os.arch              = i386
##########################################
About to execute usingSynchronized...
Results for usingSynchronized:
runnables[0]: SynchronizedRunnable[counter=989, running=false, delay=10]
runnables[1]: WastedTimeSynchronizedRunnable[counter=600, running=false, 
delay=10, minWasted=0, maxWasted=10844000, totalWasted=3976076000]
runnables[2]: WastedTimeSynchronizedRunnable[counter=610, running=false, 
delay=10, minWasted=0, maxWasted=10850000, totalWasted=3875304000]
runnables[3]: WastedTimeSynchronizedRunnable[counter=602, running=false, 
delay=10, minWasted=0, maxWasted=10851000, totalWasted=3954896000]
runnables[4]: WastedTimeSynchronizedRunnable[counter=604, running=false, 
delay=10, minWasted=0, maxWasted=10840000, totalWasted=3935276000]
runnables[5]: WastedTimeSynchronizedRunnable[counter=602, running=false, 
delay=10, minWasted=0, maxWasted=10838000, totalWasted=3955131000]
runnables[6]: WastedTimeSynchronizedRunnable[counter=606, running=false, 
delay=10, minWasted=0, maxWasted=10863000, totalWasted=3915602000]
runnables[7]: WastedTimeSynchronizedRunnable[counter=606, running=false, 
delay=10, minWasted=0, maxWasted=10841000, totalWasted=3915068000]
runnables[8]: WastedTimeSynchronizedRunnable[counter=603, running=false, 
delay=10, minWasted=0, maxWasted=10814000, totalWasted=3944606000]
runnables[9]: WastedTimeSynchronizedRunnable[counter=603, running=false, 
delay=10, minWasted=0, maxWasted=10840000, totalWasted=3944719000]
##########################################
About to execute usingUnfairLock...
Results for usingUnfairLock:
runnables[0]: LockRunnable[counter=996, running=false, delay=10]
runnables[1]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=5718199000, totalWasted=9981366000]
runnables[2]: WastedTimeLockRunnable[counter=3, running=false, delay=10, 
minWasted=0, maxWasted=8281023000, totalWasted=9971366000]
runnables[3]: WastedTimeLockRunnable[counter=1, running=false, delay=10, 
minWasted=0, maxWasted=9990838000, totalWasted=9990838000]
runnables[4]: WastedTimeLockRunnable[counter=1, running=false, delay=10, 
minWasted=0, maxWasted=9990895000, totalWasted=9990895000]
runnables[5]: WastedTimeLockRunnable[counter=1, running=false, delay=10, 
minWasted=0, maxWasted=9990802000, totalWasted=9990802000]
runnables[6]: WastedTimeLockRunnable[counter=1, running=false, delay=10, 
minWasted=0, maxWasted=9990792000, totalWasted=9990792000]
runnables[7]: WastedTimeLockRunnable[counter=1, running=false, delay=10, 
minWasted=0, maxWasted=9990720000, totalWasted=9990720000]
runnables[8]: WastedTimeLockRunnable[counter=1, running=false, delay=10, 
minWasted=0, maxWasted=9990713000, totalWasted=9990713000]
runnables[9]: WastedTimeLockRunnable[counter=1, running=false, delay=10, 
minWasted=0, maxWasted=9990647000, totalWasted=9990647000]
##########################################
About to execute usingFairLock...
Results for usingFairLock:
runnables[0]: LockRunnable[counter=985, running=false, delay=10]
runnables[1]: WastedTimeLockRunnable[counter=972, running=false, delay=10, 
minWasted=0, maxWasted=10396000, totalWasted=250077000]
runnables[2]: WastedTimeLockRunnable[counter=972, running=false, delay=10, 
minWasted=0, maxWasted=10184000, totalWasted=248853000]
runnables[3]: WastedTimeLockRunnable[counter=970, running=false, delay=10, 
minWasted=0, maxWasted=11014000, totalWasted=268824000]
runnables[4]: WastedTimeLockRunnable[counter=971, running=false, delay=10, 
minWasted=0, maxWasted=10564000, totalWasted=260988000]
runnables[5]: WastedTimeLockRunnable[counter=970, running=false, delay=10, 
minWasted=0, maxWasted=10428000, totalWasted=268175000]
runnables[6]: WastedTimeLockRunnable[counter=973, running=false, delay=10, 
minWasted=0, maxWasted=10295000, totalWasted=241207000]
runnables[7]: WastedTimeLockRunnable[counter=974, running=false, delay=10, 
minWasted=0, maxWasted=10188000, totalWasted=231224000]
runnables[8]: WastedTimeLockRunnable[counter=972, running=false, delay=10, 
minWasted=0, maxWasted=10314000, totalWasted=249652000]
runnables[9]: WastedTimeLockRunnable[counter=970, running=false, delay=10, 
minWasted=0, maxWasted=10989000, totalWasted=268618000]
##########################################



Environment:
delay                = 1
java.runtime.name    = Java(TM) SE Runtime Environment
java.runtime.version = 1.6.0_07-b06-153
java.vendor          = Apple Inc.
java.version         = 1.6.0_07
java.vm.name         = Java HotSpot(TM) 64-Bit Server VM
java.vm.info         = mixed mode
os.name              = Mac OS X
os.version           = 10.5.7
os.arch              = x86_64
##########################################
About to execute usingSynchronized...
Results for usingSynchronized:
runnables[0]: SynchronizedRunnable[counter=9673, running=false, delay=1]
runnables[1]: WastedTimeSynchronizedRunnable[counter=15, running=false, 
delay=1, minWasted=0, maxWasted=2590599000, totalWasted=9987373000]
runnables[2]: WastedTimeSynchronizedRunnable[counter=22, running=false, 
delay=1, minWasted=0, maxWasted=2675914000, totalWasted=9980257000]
runnables[3]: WastedTimeSynchronizedRunnable[counter=23, running=false, 
delay=1, minWasted=0, maxWasted=1871833000, totalWasted=9978626000]
runnables[4]: WastedTimeSynchronizedRunnable[counter=9, running=false, delay=1, 
minWasted=0, maxWasted=3243744000, totalWasted=9992860000]
runnables[5]: WastedTimeSynchronizedRunnable[counter=8, running=false, delay=1, 
minWasted=0, maxWasted=3243700000, totalWasted=9993815000]
runnables[6]: WastedTimeSynchronizedRunnable[counter=8, running=false, delay=1, 
minWasted=0, maxWasted=3243654000, totalWasted=9993713000]
runnables[7]: WastedTimeSynchronizedRunnable[counter=12, running=false, 
delay=1, minWasted=0, maxWasted=2670722000, totalWasted=9989535000]
runnables[8]: WastedTimeSynchronizedRunnable[counter=9, running=false, delay=1, 
minWasted=0, maxWasted=2959142000, totalWasted=9992392000]
runnables[9]: WastedTimeSynchronizedRunnable[counter=13, running=false, 
delay=1, minWasted=0, maxWasted=2959018000, totalWasted=9988193000]
##########################################
About to execute usingUnfairLock...
Results for usingUnfairLock:
runnables[0]: LockRunnable[counter=9607, running=false, delay=1]
runnables[1]: WastedTimeLockRunnable[counter=20, running=false, delay=1, 
minWasted=0, maxWasted=2059909000, totalWasted=9986792000]
runnables[2]: WastedTimeLockRunnable[counter=15, running=false, delay=1, 
minWasted=0, maxWasted=2059904000, totalWasted=9986182000]
runnables[3]: WastedTimeLockRunnable[counter=38, running=false, delay=1, 
minWasted=0, maxWasted=1867779000, totalWasted=9963711000]
runnables[4]: WastedTimeLockRunnable[counter=15, running=false, delay=1, 
minWasted=0, maxWasted=1832521000, totalWasted=9988460000]
runnables[5]: WastedTimeLockRunnable[counter=16, running=false, delay=1, 
minWasted=0, maxWasted=1832510000, totalWasted=9988727000]
runnables[6]: WastedTimeLockRunnable[counter=17, running=false, delay=1, 
minWasted=0, maxWasted=1976649000, totalWasted=9988772000]
runnables[7]: WastedTimeLockRunnable[counter=38, running=false, delay=1, 
minWasted=0, maxWasted=2767358000, totalWasted=9967229000]
runnables[8]: WastedTimeLockRunnable[counter=16, running=false, delay=1, 
minWasted=0, maxWasted=2732013000, totalWasted=9989731000]
runnables[9]: WastedTimeLockRunnable[counter=31, running=false, delay=1, 
minWasted=0, maxWasted=2078606000, totalWasted=9974291000]
##########################################
About to execute usingFairLock...
Results for usingFairLock:
runnables[0]: LockRunnable[counter=8495, running=false, delay=1]
runnables[1]: WastedTimeLockRunnable[counter=8400, running=false, delay=1, 
minWasted=0, maxWasted=24380000, totalWasted=1290865000]
runnables[2]: WastedTimeLockRunnable[counter=8371, running=false, delay=1, 
minWasted=0, maxWasted=21195000, totalWasted=1304971000]
runnables[3]: WastedTimeLockRunnable[counter=8387, running=false, delay=1, 
minWasted=0, maxWasted=27723000, totalWasted=1282987000]
runnables[4]: WastedTimeLockRunnable[counter=8367, running=false, delay=1, 
minWasted=0, maxWasted=22515000, totalWasted=1304042000]
runnables[5]: WastedTimeLockRunnable[counter=8350, running=false, delay=1, 
minWasted=0, maxWasted=37975000, totalWasted=1333368000]
runnables[6]: WastedTimeLockRunnable[counter=8389, running=false, delay=1, 
minWasted=0, maxWasted=29434000, totalWasted=1294695000]
runnables[7]: WastedTimeLockRunnable[counter=8397, running=false, delay=1, 
minWasted=0, maxWasted=27503000, totalWasted=1271671000]
runnables[8]: WastedTimeLockRunnable[counter=8387, running=false, delay=1, 
minWasted=0, maxWasted=27743000, totalWasted=1293263000]
runnables[9]: WastedTimeLockRunnable[counter=8372, running=false, delay=1, 
minWasted=0, maxWasted=27691000, totalWasted=1295582000]
##########################################



Environment:
delay                = 10
java.runtime.name    = Java(TM) SE Runtime Environment
java.runtime.version = 1.6.0_07-b06-153
java.vendor          = Apple Inc.
java.version         = 1.6.0_07
java.vm.name         = Java HotSpot(TM) 64-Bit Server VM
java.vm.info         = mixed mode
os.name              = Mac OS X
os.version           = 10.5.7
os.arch              = x86_64
##########################################
About to execute usingSynchronized...
Results for usingSynchronized:
runnables[0]: SynchronizedRunnable[counter=997, running=false, delay=10]
runnables[1]: WastedTimeSynchronizedRunnable[counter=1, running=false, 
delay=10, minWasted=0, maxWasted=9991803000, totalWasted=9991803000]
runnables[2]: WastedTimeSynchronizedRunnable[counter=1, running=false, 
delay=10, minWasted=0, maxWasted=9991705000, totalWasted=9991705000]
runnables[3]: WastedTimeSynchronizedRunnable[counter=1, running=false, 
delay=10, minWasted=0, maxWasted=9991312000, totalWasted=9991312000]
runnables[4]: WastedTimeSynchronizedRunnable[counter=1, running=false, 
delay=10, minWasted=0, maxWasted=9991104000, totalWasted=9991104000]
runnables[5]: WastedTimeSynchronizedRunnable[counter=1, running=false, 
delay=10, minWasted=0, maxWasted=9990939000, totalWasted=9990939000]
runnables[6]: WastedTimeSynchronizedRunnable[counter=1, running=false, 
delay=10, minWasted=0, maxWasted=9990764000, totalWasted=9990764000]
runnables[7]: WastedTimeSynchronizedRunnable[counter=1, running=false, 
delay=10, minWasted=0, maxWasted=9990540000, totalWasted=9990540000]
runnables[8]: WastedTimeSynchronizedRunnable[counter=11, running=false, 
delay=10, minWasted=0, maxWasted=7930974000, totalWasted=9890440000]
runnables[9]: WastedTimeSynchronizedRunnable[counter=6, running=false, 
delay=10, minWasted=0, maxWasted=7592208000, totalWasted=9940592000]
##########################################
About to execute usingUnfairLock...
Results for usingUnfairLock:
runnables[0]: LockRunnable[counter=996, running=false, delay=10]
runnables[1]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9757274000, totalWasted=9981028000]
runnables[2]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9757284000, totalWasted=9982310000]
runnables[3]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9757167000, totalWasted=9982302000]
runnables[4]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9757132000, totalWasted=9982360000]
runnables[5]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9757062000, totalWasted=9982479000]
runnables[6]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9756981000, totalWasted=9982632000]
runnables[7]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9756907000, totalWasted=9982735000]
runnables[8]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9756817000, totalWasted=9983801000]
runnables[9]: WastedTimeLockRunnable[counter=2, running=false, delay=10, 
minWasted=0, maxWasted=9756758000, totalWasted=9985104000]
##########################################
About to execute usingFairLock...
Results for usingFairLock:
runnables[0]: LockRunnable[counter=981, running=false, delay=10]
runnables[1]: WastedTimeLockRunnable[counter=968, running=false, delay=10, 
minWasted=0, maxWasted=12768000, totalWasted=282213000]
runnables[2]: WastedTimeLockRunnable[counter=964, running=false, delay=10, 
minWasted=0, maxWasted=12802000, totalWasted=321530000]
runnables[3]: WastedTimeLockRunnable[counter=967, running=false, delay=10, 
minWasted=0, maxWasted=12773000, totalWasted=293688000]
runnables[4]: WastedTimeLockRunnable[counter=962, running=false, delay=10, 
minWasted=0, maxWasted=11011000, totalWasted=330372000]
runnables[5]: WastedTimeLockRunnable[counter=963, running=false, delay=10, 
minWasted=0, maxWasted=22772000, totalWasted=330998000]
runnables[6]: WastedTimeLockRunnable[counter=968, running=false, delay=10, 
minWasted=0, maxWasted=10242000, totalWasted=269637000]
runnables[7]: WastedTimeLockRunnable[counter=966, running=false, delay=10, 
minWasted=0, maxWasted=10276000, totalWasted=290630000]
runnables[8]: WastedTimeLockRunnable[counter=963, running=false, delay=10, 
minWasted=0, maxWasted=22807000, totalWasted=333009000]
runnables[9]: WastedTimeLockRunnable[counter=968, running=false, delay=10, 
minWasted=0, maxWasted=12816000, totalWasted=282952000]
##########################################


> Starvation on AppenderBase.doAppend
> -----------------------------------
>
>                 Key: LBCORE-97
>                 URL: http://jira.qos.ch/browse/LBCORE-97
>             Project: logback-core
>          Issue Type: Bug
>          Components: Appender
>    Affects Versions: 0.9.15
>            Reporter: Joern Huxhorn
>            Assignee: Logback dev list
>            Priority: Critical
>         Attachments: AppenderBaseLock3.patch, SynchronizedVsFairLock.java, 
> TimeWasted.java
>
>
> The problem we are facing here is that several threads are trying to obtain 
> the object monitor of the exact same resource, namely the Appender.
> The assumption that multiple threads waiting for ownership of a monitor would 
> receive the monitor in the order that they tried to acquire it is simply 
> incorrect. This is documented behavior.
> See the last paragraph of [1]:
> "Likewise, no assumptions should be made about the order in which threads are 
> granted ownership of a monitor or the order in which threads wake in response 
> to the notify or notifyAll method. An excellent reference for these topics is 
> Chapter 9, "Threads," in Joshua Bloch's book Effective Java Programming 
> Language Guide. "
> The documentation of Object.notifyAll() [2] states the following:
> "[..] The awakened threads will compete in the usual manner with any other 
> threads that might be actively competing to synchronize on this object; for 
> example, the awakened threads enjoy no reliable privilege or disadvantage in 
> being the next thread to lock this object."
> The documentation in [5] also lists the following as a weak-spot of Built-in 
> Synchronization in J2SE 1.4.x:
> "No way to alter the semantics of a lock, for example, with respect to 
> reentrancy, read versus write protection, or fairness."
> In LBCORE-96 Ceki stated the following:
> "Logback is using the standard synchronization mechanism found in the JDK. 
> You are saying that that mechanism is unsuitable which, truth be told, sounds 
> quite suspicious."
> Yes, it's unsuitable in this situation because obtaining the object monitor 
> is not guaranteed to be fair. It's not working in a "first come, first serve" 
> manner. I assumed that, too, but it isn't the case. I had the exact same 
> problem in Lilith some time ago because I made exactly this very same wrong 
> assumption.
> Fairness of object monitor lock acquisition seems to be logical and a "good 
> thing" but it's not specified that way, and for good reasons.
> Without fairness in place, the VM can optimize the execution of an 
> application much better. A context switch is a costly operation for a CPU so 
> performance is increased significantly if such a switch can be omitted.
> Concerning a test-case, this would be pretty hardcore to implement since it's 
> 100% implementation dependent. One implementation *may* handle the locking of 
> object monitors fairly while others don't.
> Therefore I'll try the following first:
> I assume I could convince you that object monitor acquisition (OMA) is not 
> fair.
> If we take that for granted the following scenario should show my point:
> There are 4 Threads (e.g. 4 Threads handling concurrent webapp-requests) that 
> have one single chokepoint, the appender.
> Since OMA isn't fair, it's possible that only some of those threads can work 
> at all (see [3]). Exactly that is happening right now in our webapp running 
> on a 4-core Solaris on JDK6.
> My next assumption is that we both agree that this isn't acceptable behavior.
> Logging should be handled "first come, first served" so that if Thread A is 
> waiting to append an event and Thread B is waiting to append an event 
> subsequently, the actual appending order should be A, then B.
> This is currently not the case. It *may* be the case but there is no 
> guarantee of it.
> One could even argue that the logging system is working incorrectly (aside 
> from the starvation problem) because events are appended in a different order 
> than the actual execution of the logger call.
> The only way to prevent this is the introduction of fairness into the locking 
> process. The way to do this is to use ReentrantLock [4].
> From the ReentrantLock javadoc:
> "The constructor for this class accepts an optional fairness parameter. When 
> set true, under contention, locks favor granting access to the 
> longest-waiting thread. Otherwise this lock does not guarantee any particular 
> access order. Programs using fair locks accessed by many threads may display 
> lower overall throughput (i.e., are slower; often much slower) than those 
> using the default setting, but have smaller variances in times to obtain 
> locks and guarantee lack of starvation."
> This is exactly what is absolutely necessary for a logging framework.
> Logging must *NOT* be able to introduce a starvation problem into a 
> multi-threaded application! And it does exactly that right now.
> I doubt that the performance will decrease in a significant manner due to the 
> use of a fair ReentrantLock but even if this would be the case it would be 
> necessary anyway.
> Otherwise, appending simply isn't working correctly.
> [1] http://java.sun.com/j2se/1.5.0/docs/guide/vm/thread-priorities.html
> [2] http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()
> [3] http://en.wikipedia.org/wiki/Starvation_(computing)
> [4] 
> http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html
> [5] http://java.sun.com/developer/technicalArticles/J2SE/concurrency/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev

Reply via email to