[
https://issues.apache.org/jira/browse/ARTEMIS-2323?focusedWorklogId=239413&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-239413
]
ASF GitHub Bot logged work on ARTEMIS-2323:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 08/May/19 19:10
Start Date: 08/May/19 19:10
Worklog Time Spent: 10m
Work Description: franz1981 commented on pull request #2647: ARTEMIS-2323
NettyTransport should also send requests with void promises
URL: https://github.com/apache/activemq-artemis/pull/2647#discussion_r282207969
##########
File path:
tests/artemis-test-support/src/main/java/org/apache/activemq/transport/netty/NettyTcpTransport.java
##########
@@ -222,17 +226,34 @@ public ByteBuf allocateSendBuffer(int size) throws
IOException {
return channel.alloc().ioBuffer(size, size);
}
- @Override
- public ChannelFuture send(ByteBuf output) throws IOException {
- checkConnected();
+ protected final ChannelFuture writeAndFlush(ByteBuf output,
+ ChannelPromise promise,
+ Function<? super ByteBuf, ?
extends ReferenceCounted> bufferTransformer) throws IOException {
+ try {
+ checkConnected();
+ } catch (IOException ioEx) {
+ output.release();
+ throw ioEx;
+ }
int length = output.readableBytes();
if (length == 0) {
+ output.release();
return null;
}
LOG.trace("Attempted write of: {} bytes", length);
- return channel.writeAndFlush(output);
+ return channel.writeAndFlush(bufferTransformer.apply(output), promise);
+ }
+
+ @Override
+ public ChannelFuture send(ByteBuf output) throws IOException {
+ return writeAndFlush(output, channel.newPromise(), identity());
+ }
+
+ @Override
+ public void sendVoidPromise(ByteBuf output) throws IOException {
+ writeAndFlush(output, channel.voidPromise(), identity());
Review comment:
Yes we can always use void primise as long as we don't need a callback: if
the callback is used void promise won't work
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 239413)
Time Spent: 1h 20m (was: 1h 10m)
> NettyTransport should also send requests with void promises
> -----------------------------------------------------------
>
> Key: ARTEMIS-2323
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2323
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Components: AMQP, STOMP
> Affects Versions: 2.8.0
> Reporter: Francesco Nigro
> Assignee: Justin Bertram
> Priority: Minor
> Fix For: 2.8.0
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> AmqpConnection is using NettyTransport::send without making use of
> ChannelFuture
> return type, but NettyTcpTransport/NettyWSTransport always allocate a new
> ChannelPromise
> on each call.
> If such ChannelFuture isn't needed (like STOMP does) it would be better to
> avoid the ChannelPromise instantiation and enhance the API with a proper
> method.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)