This repository was archived by the owner on May 28, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/common Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 40
40
41
41
package org .glassfish .jersey .tests .e2e .common ;
42
42
43
+ import java .util .concurrent .CountDownLatch ;
44
+ import java .util .concurrent .TimeUnit ;
45
+
43
46
import javax .ws .rs .GET ;
44
47
import javax .ws .rs .Path ;
45
48
import javax .ws .rs .core .Application ;
@@ -86,7 +89,7 @@ public interface CloseMe {
86
89
87
90
public static class CloseMeFactory implements Factory <CloseMe > {
88
91
89
- public static volatile boolean closed = false ;
92
+ private static final CountDownLatch CLOSED_LATCH = new CountDownLatch ( 1 ) ;
90
93
91
94
@ Override
92
95
public CloseMe provide () {
@@ -98,7 +101,7 @@ public String eval() {
98
101
99
102
@ Override
100
103
public void close () {
101
- closed = true ;
104
+ CLOSED_LATCH . countDown () ;
102
105
}
103
106
};
104
107
}
@@ -135,6 +138,6 @@ public void testRemove() throws Exception {
135
138
assertThat (response .getStatus (), is (200 ));
136
139
assertThat (response .readEntity (String .class ), is ("foo" ));
137
140
138
- assertTrue (CloseMeFactory .closed );
141
+ assertTrue (CloseMeFactory .CLOSED_LATCH . await ( 3 , TimeUnit . SECONDS ) );
139
142
}
140
143
}
You can’t perform that action at this time.
0 commit comments