diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java index 0c66aeff20..e7c33ffd7d 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java @@ -84,8 +84,6 @@ public abstract class MessageImpl implements MessageInternal { private int endOfMessagePosition; - private boolean copied = true; - private UUID userID; // Constructors -------------------------------------------------- @@ -152,7 +150,6 @@ public abstract class MessageImpl implements MessageInternal { bufferValid = other.bufferValid; endOfBodyPosition = other.endOfBodyPosition; endOfMessagePosition = other.endOfMessagePosition; - copied = other.copied; if (other.buffer != null) { // We need to copy the underlying buffer too, since the different messsages thereafter might have different @@ -438,29 +435,11 @@ public abstract class MessageImpl implements MessageInternal { @Override public void bodyChanged() { - // If the body is changed we must copy the buffer otherwise can affect the previously sent message - // which might be in the Netty write queue - checkCopy(); - bufferValid = false; endOfBodyPosition = -1; } - @Override - public synchronized void checkCopy() { - if (!copied) { - forceCopy(); - - copied = true; - } - } - - @Override - public synchronized void resetCopied() { - copied = false; - } - @Override public int getEndOfMessagePosition() { return endOfMessagePosition; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageInternal.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageInternal.java index 728f1c557c..a7b2199e94 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageInternal.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageInternal.java @@ -33,12 +33,8 @@ public interface MessageInternal extends Message { int getEndOfBodyPosition(); - void checkCopy(); - void bodyChanged(); - void resetCopied(); - boolean isServerMessage(); ActiveMQBuffer getEncodedBuffer(); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java index 300f8ed0de..78d48621b1 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java @@ -93,8 +93,6 @@ public class SessionSendMessage extends MessagePacket { // Position reader for reading by Netty bufferWrite.readerIndex(0); - message.resetCopied(); - return bufferWrite; } diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java index fe9d9053c7..5eb269247d 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java @@ -280,7 +280,7 @@ public class JournalFilesRepository { ActiveMQJournalLogger.LOGGER.checkFiles(); ActiveMQJournalLogger.LOGGER.info(debugFiles()); ActiveMQJournalLogger.LOGGER.seqOutOfOrder(); - System.exit(-1); + throw new IllegalStateException("Sequence out of order"); } if (journal.getCurrentFile() != null && journal.getCurrentFile().getFileID() <= file.getFileID()) { @@ -356,9 +356,7 @@ public class JournalFilesRepository { calculatedSize = file.getFile().size(); } catch (Exception e) { - e.printStackTrace(); - System.out.println("Can't get file size on " + file); - System.exit(-1); + throw new IllegalStateException(e.getMessage() + " file: " + file); } if (calculatedSize != fileSize) { ActiveMQJournalLogger.LOGGER.deletingFile(file); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java index 2448b29538..e3d6850b91 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java @@ -429,21 +429,11 @@ public class ScheduledDeliveryHandlerTest extends Assert { return 0; } - @Override - public void checkCopy() { - - } - @Override public void bodyChanged() { } - @Override - public void resetCopied() { - - } - @Override public boolean isServerMessage() { return false;