1
1
/*
2
- * Copyright (c) 2002, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2002, 2023 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -56,8 +56,8 @@ public void run() {
56
56
lock .wait ();
57
57
}
58
58
} catch (InterruptedException e ) {
59
- notInterrupted .decrementAndGet ();
60
59
synchronized (waitnotify ) {
60
+ notInterrupted --;
61
61
waitnotify .notify ();
62
62
}
63
63
}
@@ -83,7 +83,7 @@ static void breakHere () {}
83
83
private JdbArgumentHandler argumentHandler ;
84
84
private Log log ;
85
85
86
- public static final AtomicInteger notInterrupted = new AtomicInteger ( numThreads ) ;
86
+ public static volatile int notInterrupted = numThreads ;
87
87
88
88
public int runIt (String args [], PrintStream out ) {
89
89
@@ -122,8 +122,8 @@ public int runIt(String args[], PrintStream out) {
122
122
123
123
long waitTime = argumentHandler .getWaitTime () * 60 * 1000 ;
124
124
long startTime = System .currentTimeMillis ();
125
- while ( notInterrupted . get () > 0 && System . currentTimeMillis () - startTime <= waitTime ) {
126
- synchronized ( waitnotify ) {
125
+ synchronized ( waitnotify ) {
126
+ while ( notInterrupted > 0 && System . currentTimeMillis () - startTime <= waitTime ) {
127
127
try {
128
128
waitnotify .wait (waitTime );
129
129
} catch (InterruptedException e ) {
0 commit comments