gemmellr commented on code in PR #4840: URL: https://github.com/apache/activemq-artemis/pull/4840#discussion_r1514629712
########## artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonAbstractReceiver.java: ########## @@ -320,28 +325,45 @@ public final void onMessage(Delivery delivery) throws ActiveMQAMQPException { return; } - final Message message = messageReader.readBytes(delivery); + { Review Comment: Needed? Its already inside a small try block where this is the only actual work. ########## artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java: ########## @@ -81,33 +84,55 @@ public boolean isWriting() { public void close() { if (!closed) { try { + try { + if (largeBodyReader != null) { + largeBodyReader.close(); + } + } catch (Exception e) { + // if we get an error only at this point, there's nothing else we could do other than log.warn + logger.warn("{}", e.getMessage(), e); + } if (message != null) { message.usageDown(); } } finally { - reset(true); + resetClosed(); } } } @Override - public AMQPLargeMessageWriter open() { - if (!closed) { - throw new IllegalStateException("Trying to open an AMQP Large Message writer that was not closed"); Review Comment: Is it now allowed to duplicate-open a writer? Doesnt seem like it should be given what it does. ########## artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonAbstractReceiver.java: ########## @@ -320,28 +325,45 @@ public final void onMessage(Delivery delivery) throws ActiveMQAMQPException { return; } - final Message message = messageReader.readBytes(delivery); + { + Message completeMessage; + if ((completeMessage = messageReader.readBytes(delivery)) != null) { + // notice the AMQP Large Message Reader will always return false + // and call the onMessageComplete directly + // since that happens asynchronously Review Comment: return null? ########## artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ProtonHandler.java: ########## @@ -213,9 +224,7 @@ public boolean isHandler() { } public void requireHandler() { - if (!workerExecutor.inEventLoop()) { - throw new IllegalStateException("this method requires to be called within the handler, use the executor"); - } + assert workerExecutor.inEventLoop(); Review Comment: Is the trade-off worth it? If it goes wrong in live usage then previously we would always find out. Now we probably wont, except any weird consequences of illegal use. Also feels like a separate change either way. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org