ARTEMIS-3085 Fixing test and proper wiring listener
This commit is contained in:
parent
b46ccddf26
commit
f5d9eed9ce
|
@ -101,7 +101,7 @@ public class NullStorageManager implements StorageManager {
|
|||
|
||||
@Override
|
||||
public void criticalError(Throwable error) {
|
||||
|
||||
ioCriticalErrorListener.onIOException(error, error.getMessage(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4293,6 +4293,14 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
for (IOCriticalErrorListener listener : ioCriticalErrorListeners) {
|
||||
listener.onIOException(cause, message, file);
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
logger.debug("Ignored exception {}", ignored.getMessage(), ignored);
|
||||
}
|
||||
|
||||
if (file == null) {
|
||||
ActiveMQServerLogger.LOGGER.ioCriticalIOError(message, "NULL", cause);
|
||||
} else {
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.tests.integration.server;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -30,16 +28,11 @@ public class IOCriticalErrorListenerTest extends ActiveMQTestBase {
|
|||
|
||||
@Test
|
||||
public void simpleTest() throws Exception {
|
||||
ServerSocket s = new ServerSocket();
|
||||
try {
|
||||
s.bind(new InetSocketAddress("127.0.0.1", 61616));
|
||||
server = createServer(false, createDefaultNettyConfig());
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
server.registerIOCriticalErrorListener((code, message, file) -> latch.countDown());
|
||||
server.start();
|
||||
assertTrue(latch.await(3000, TimeUnit.MILLISECONDS));
|
||||
} finally {
|
||||
s.close();
|
||||
}
|
||||
server = createServer(false, createDefaultNettyConfig());
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
server.registerIOCriticalErrorListener((code, message, file) -> latch.countDown());
|
||||
server.start();
|
||||
server.getStorageManager().criticalError(new Exception("Fake Failure"));
|
||||
assertTrue(latch.await(3000, TimeUnit.MILLISECONDS));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue