Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1190#discussion_r110703818
--- Diff:
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
---
@@ -167,6 +168,36 @@ public ActiveMQSessionContext(String name,
}
}
+ private static int sendSessionSendContinuationMessage(Channel channel,
+ Message msgI,
+ long
messageBodySize,
+ boolean
sendBlocking,
+ boolean lastChunk,
+ byte[] chunk,
+
SendAcknowledgementHandler messageHandler) throws ActiveMQException {
+ final boolean requiresResponse = lastChunk && sendBlocking;
+ final SessionSendContinuationMessage chunkPacket = new
SessionSendContinuationMessage(msgI, chunk, !lastChunk, requiresResponse,
messageBodySize, messageHandler);
+ final int expectedEncodeSize = chunkPacket.expectedEncodeSize();
+ //perform a weak form of flow control to avoid OOM on tight loops
+ final CoreRemotingConnection connection = channel.getConnection();
+ final long blockingCallTimeoutMillis = Math.max(0,
connection.getBlockingCallTimeout());
+ final long startFlowControl = System.nanoTime();
+ final boolean isWritable =
connection.blockUntilWritable(expectedEncodeSize, blockingCallTimeoutMillis);
+ if (!isWritable) {
+ final long endFlowControl = System.nanoTime();
+ final long elapsedFlowControl = endFlowControl - startFlowControl;
+ final long elapsedMillis =
TimeUnit.NANOSECONDS.toMillis(elapsedFlowControl);
+ logger.warn("try to write " + expectedEncodeSize + " bytes after
blocked " + elapsedMillis + " ms on a not writable connection: [" +
connection.getID() + "]");
--- End diff --
last thing Missing... define method through Logger please?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---