ARTEMIS-831 avoid shutting down the server after interrupted threads on

divert (copy and rename)

probably introduced at ARTEMIS-322
This commit is contained in:
Ravi Soni 2016-10-27 21:47:35 -04:00 committed by Clebert Suconic
parent 10187d0036
commit b4924ce73b
1 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.io;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
@ -117,6 +118,8 @@ public abstract class AbstractSequentialFile implements SequentialFile {
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;
@ -140,6 +143,8 @@ public abstract class AbstractSequentialFile implements SequentialFile {
public final void renameTo(final String newFileName) throws IOException, InterruptedException, ActiveMQException {
try {
close();
} catch (ClosedChannelException e) {
throw e;
} catch (IOException e) {
factory.onIOError(new ActiveMQIOErrorException(e.getMessage(), e), e.getMessage(), this);
throw e;