From 7957f574f69e8ac037e3c7f187e2fca3ef9c05ae Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Sat, 23 Jan 2016 10:45:35 -0500 Subject: [PATCH 1/2] ARTEMIS-357 No need to check copy any longer --- .../core/message/impl/MessageImpl.java | 21 ------------------- .../core/message/impl/MessageInternal.java | 4 ---- .../impl/wireformat/SessionSendMessage.java | 2 -- .../impl/ScheduledDeliveryHandlerTest.java | 10 --------- 4 files changed, 37 deletions(-) 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-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; From 928ec603aabe6b7e4750e4957289dd0a0d038318 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Sat, 23 Jan 2016 16:42:37 -0500 Subject: [PATCH 2/2] Removing invalid System.exit --- .../artemis/core/journal/impl/JournalFilesRepository.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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);