ARTEMIS-1117 Improving IO Failure resilience Part I
Me (Clebert) and Francesco worked independently here. I am keeping Francesco's changes on a separate commit https://issues.apache.org/jira/browse/ARTEMIS-1117
This commit is contained in:
parent
7d5511cfb4
commit
23ba3e27d9
|
@ -18,6 +18,8 @@ package org.apache.activemq.artemis.core.io.aio;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.lang.management.ThreadInfo;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.PriorityQueue;
|
import java.util.PriorityQueue;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
@ -100,16 +102,34 @@ public class AIOSequentialFile extends AbstractSequentialFile {
|
||||||
|
|
||||||
super.close();
|
super.close();
|
||||||
|
|
||||||
if (!pendingCallbacks.await(10, TimeUnit.SECONDS)) {
|
final String fileName = this.getFileName();
|
||||||
|
try {
|
||||||
|
int waitCount = 0;
|
||||||
|
while (!pendingCallbacks.await(10, TimeUnit.SECONDS)) {
|
||||||
|
waitCount++;
|
||||||
|
if (waitCount == 1) {
|
||||||
|
final ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
|
||||||
|
for (ThreadInfo threadInfo : threads) {
|
||||||
|
ActiveMQJournalLogger.LOGGER.warn(threadInfo.toString());
|
||||||
|
}
|
||||||
factory.onIOError(new IOException("Timeout on close"), "Timeout on close", this);
|
factory.onIOError(new IOException("Timeout on close"), "Timeout on close", this);
|
||||||
}
|
}
|
||||||
|
ActiveMQJournalLogger.LOGGER.warn("waiting pending callbacks on " + fileName + " from " + (waitCount * 10) + " seconds!");
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
ActiveMQJournalLogger.LOGGER.warn("interrupted while waiting pending callbacks on " + fileName, e);
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
|
||||||
opened = false;
|
opened = false;
|
||||||
|
|
||||||
timedBuffer = null;
|
timedBuffer = null;
|
||||||
|
|
||||||
aioFile.close();
|
aioFile.close();
|
||||||
|
|
||||||
aioFile = null;
|
aioFile = null;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue