NO-JIRA Fixing a deadlock during #tearDown and TimedBuffer.stop
This commit is contained in:
parent
67d6bf4844
commit
0273e3e4ff
|
@ -170,6 +170,7 @@ public final class TimedBuffer extends CriticalComponentImpl {
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
enterCritical(CRITICAL_PATH_STOP);
|
enterCritical(CRITICAL_PATH_STOP);
|
||||||
|
Thread localTimer = null;
|
||||||
try {
|
try {
|
||||||
// add critical analyzer here.... <<<<
|
// add critical analyzer here.... <<<<
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
@ -190,17 +191,25 @@ public final class TimedBuffer extends CriticalComponentImpl {
|
||||||
logRatesTimerTask.cancel();
|
logRatesTimerTask.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (timerThread.isAlive()) {
|
localTimer = timerThread;
|
||||||
try {
|
timerThread = null;
|
||||||
timerThread.join();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new ActiveMQInterruptedException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (localTimer != null) {
|
||||||
|
while (localTimer.isAlive()) {
|
||||||
|
try {
|
||||||
|
localTimer.join(1000);
|
||||||
|
if (localTimer.isAlive()) {
|
||||||
|
localTimer.interrupt();
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new ActiveMQInterruptedException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
leaveCritical(CRITICAL_PATH_STOP);
|
leaveCritical(CRITICAL_PATH_STOP);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue