use of org.apache.activemq.artemis.api.core.ActiveMQIOErrorException in project activemq-artemis by apache.
the class NIOSequentialFile method open.
@Override
public void open(final int maxIO, final boolean useExecutor) throws IOException {
try {
rfile = new RandomAccessFile(getFile(), "rw");
channel = rfile.getChannel();
fileSize = channel.size();
} catch (ClosedChannelException e) {
throw e;
} catch (IOException e) {
factory.onIOError(new ActiveMQIOErrorException(e.getMessage(), e), e.getMessage(), this);
throw e;
}
}
use of org.apache.activemq.artemis.api.core.ActiveMQIOErrorException in project activemq-artemis by apache.
the class TemporaryQueueTest method testRecreateConsumerOverServerFailure.
@Test
public void testRecreateConsumerOverServerFailure() throws Exception {
ServerLocator serverWithReattach = createInVMNonHALocator().setReconnectAttempts(30).setRetryInterval(1000).setConfirmationWindowSize(-1).setConnectionTTL(TemporaryQueueTest.CONNECTION_TTL).setClientFailureCheckPeriod(TemporaryQueueTest.CONNECTION_TTL / 3);
ClientSessionFactory reattachSF = createSessionFactory(serverWithReattach);
ClientSession session = reattachSF.createSession(false, false);
session.createTemporaryQueue("tmpAd", "tmpQ");
ClientConsumer consumer = session.createConsumer("tmpQ");
ClientProducer prod = session.createProducer("tmpAd");
session.start();
RemotingConnectionImpl conn = (RemotingConnectionImpl) ((ClientSessionInternal) session).getConnection();
conn.fail(new ActiveMQIOErrorException());
prod.send(session.createMessage(false));
session.commit();
assertNotNull(consumer.receive(1000));
session.close();
reattachSF.close();
serverWithReattach.close();
}
use of org.apache.activemq.artemis.api.core.ActiveMQIOErrorException in project activemq-artemis by apache.
the class AbstractSequentialFile method copyTo.
@Override
public void copyTo(SequentialFile newFileName) throws Exception {
try {
ActiveMQJournalLogger.LOGGER.debug("Copying " + this + " as " + newFileName);
if (!newFileName.isOpen()) {
newFileName.open();
}
if (!isOpen()) {
this.open();
}
ByteBuffer buffer = ByteBuffer.allocate(10 * 1024);
FileIOUtil.copyData(this, newFileName, buffer);
newFileName.close();
this.close();
} catch (ClosedChannelException e) {
throw e;
} catch (IOException e) {
factory.onIOError(new ActiveMQIOErrorException(e.getMessage(), e), e.getMessage(), this);
throw e;
}
}
Aggregations