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,7 +463,8 @@ public class Journal {
return dataFile.getNext();
}
public synchronized void close() throws IOException {
public void close() throws IOException {
synchronized (this) {
if (!started) {
return;
}
@ -471,13 +472,17 @@ public class Journal {
this.timer.cancel();
}
accessorPool.close();
}
// the appender can be calling back to to the journal blocking a close AMQ-5620
appender.close();
synchronized (this) {
fileMap.clear();
fileByFileMap.clear();
dataFiles.clear();
lastAppendLocation.set(null);
started = false;
}
}
protected synchronized void cleanup() {
if (accessorPool != null) {