+ improve shutdown of Redis container (skipped waiting if the container is not started)

This commit is contained in:
Costin Leau
2011-01-24 21:53:34 +02:00
parent 31a2a2395d
commit 560b38c0fc

View File

@@ -193,13 +193,17 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
@Override
public void stop() {
running = false;
synchronized (monitor) {
subscriptionTask.cancel();
try {
monitor.wait(initWait);
} catch (InterruptedException ex) {
// stop waiting
if (isRunning()) {
running = false;
synchronized (monitor) {
subscriptionTask.cancel();
if (listening) {
try {
monitor.wait(initWait);
} catch (InterruptedException ex) {
// stop waiting
}
}
}
}
@@ -341,10 +345,6 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
started = true;
}
}
else {
listening = false;
}
}
if (debug) {
if (started) {