https://issues.apache.org/jira/browse/AMQ-5620 - avoid potential deadlock on shutdown - waiting on connections to stop before stopping the pa would be an alternative but may block for ever, auto rollback ensures there is no need

This commit is contained in:
gtully 2015-03-02 14:09:58 +00:00
parent 4f57744934
commit 260e28ecad
1 changed files with 17 additions and 12 deletions

View File

@ -463,20 +463,25 @@ public class Journal {
return dataFile.getNext();
}
public synchronized void close() throws IOException {
if (!started) {
return;
public void close() throws IOException {
synchronized (this) {
if (!started) {
return;
}
if (this.timer != null) {
this.timer.cancel();
}
accessorPool.close();
}
if (this.timer != null) {
this.timer.cancel();
}
accessorPool.close();
// the appender can be calling back to to the journal blocking a close AMQ-5620
appender.close();
fileMap.clear();
fileByFileMap.clear();
dataFiles.clear();
lastAppendLocation.set(null);
started = false;
synchronized (this) {
fileMap.clear();
fileByFileMap.clear();
dataFiles.clear();
lastAppendLocation.set(null);
started = false;
}
}
protected synchronized void cleanup() {