43
43
import java .util .concurrent .locks .Lock ;
44
44
import java .util .concurrent .locks .ReentrantLock ;
45
45
46
+ import static com .mongodb .ClusterFixture .TIMEOUT ;
46
47
import static java .util .Collections .emptyList ;
47
48
import static org .junit .Assert .assertEquals ;
48
49
import static org .junit .Assert .assertNull ;
@@ -130,7 +131,7 @@ public List<CommandEvent> getCommandStartedEvents() {
130
131
private List <CommandEvent > getCommandStartedEvents (final int maxEvents ) {
131
132
lock .lock ();
132
133
try {
133
- List <CommandEvent > commandStartedEvents = new ArrayList <CommandEvent >();
134
+ List <CommandEvent > commandStartedEvents = new ArrayList <>();
134
135
for (CommandEvent cur : getEvents ()) {
135
136
if (cur instanceof CommandStartedEvent ) {
136
137
commandStartedEvents .add (cur );
@@ -150,7 +151,7 @@ public List<CommandEvent> waitForStartedEvents(final int numEvents) {
150
151
try {
151
152
while (!hasCompletedEvents (numEvents )) {
152
153
try {
153
- if (!commandCompletedCondition .await (10 , TimeUnit .SECONDS )) {
154
+ if (!commandCompletedCondition .await (TIMEOUT , TimeUnit .SECONDS )) {
154
155
throw new MongoTimeoutException ("Timeout waiting for event" );
155
156
}
156
157
} catch (InterruptedException e ) {
@@ -168,7 +169,7 @@ public void waitForFirstCommandCompletion() {
168
169
try {
169
170
while (!hasCompletedEvents (1 )) {
170
171
try {
171
- if (!commandCompletedCondition .await (10 , TimeUnit .SECONDS )) {
172
+ if (!commandCompletedCondition .await (TIMEOUT , TimeUnit .SECONDS )) {
172
173
throw new MongoTimeoutException ("Timeout waiting for event" );
173
174
}
174
175
} catch (InterruptedException e ) {
0 commit comments