File tree Expand file tree Collapse file tree
logback-core/src/test/java/ch/qos/logback/core/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,13 +67,14 @@ public void beforeEach() {
6767 // see https://jira.qos.ch/browse/LOGBACK-1754
6868 @ Test
6969 public void assertNoOverlappingFileLockException () throws IOException {
70- CountDownLatch latch = new CountDownLatch (THREAD_COUNT );
70+ CountDownLatch latch = new CountDownLatch (1 );
7171 List <Thread > threads = new ArrayList <>(THREAD_COUNT );
7272 for (int i = 0 ; i < THREAD_COUNT ; i ++) {
7373 LoggerThread thread = new LoggerThread (latch , "message from thread " + i );
7474 thread .start ();
7575 threads .add (thread );
7676 }
77+ latch .countDown ();
7778 int i = 0 ;
7879 for (Thread thread : threads ) {
7980 try {
@@ -106,13 +107,17 @@ class LoggerThread extends Thread {
106107
107108 @ Override
108109 public void run () {
109- latch .countDown ();
110- for (int i = 0 ; i < LOOP_COUNT ; i ++) {
111- if ((i & 0x08 ) == 0 ) {
112- // yield to spice it up
113- Thread .yield ();
110+ try {
111+ latch .await ();
112+ for (int i = 0 ; i < LOOP_COUNT ; i ++) {
113+ if ((i & 0x08 ) == 0 ) {
114+ // yield to spice it up
115+ Thread .yield ();
116+ }
117+ PrudentModeTest .this .fa .doAppend (message + " i=" + i );
114118 }
115- PrudentModeTest .this .fa .doAppend (message + " i=" + i );
119+ } catch (InterruptedException ex ) {
120+ Thread .currentThread ().interrupt ();
116121 }
117122 }
118123
You can’t perform that action at this time.
0 commit comments