[2/2] qpid-jms git commit: This closes #19
This closes #19 Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/d5be8518 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/d5be8518 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/d5be8518 Branch: refs/heads/master Commit: d5be8518e83f2827dca1de6dbb99ca8358af1d66 Parents: 1baf3e2 d11e275 Author: Timothy Bish Authored: Wed Jul 11 14:59:23 2018 -0400 Committer: Timothy Bish Committed: Wed Jul 11 14:59:23 2018 -0400 -- .../org/apache/qpid/jms/transports/netty/NettyTcpTransport.java | 4 ++-- .../org/apache/qpid/jms/transports/netty/NettyWsTransport.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[1/2] qpid-jms git commit: QPIDJMS-401 Save allocation of new promise on each writeAndFlush
Repository: qpid-jms Updated Branches: refs/heads/master 1baf3e2cb -> d5be8518e QPIDJMS-401 Save allocation of new promise on each writeAndFlush Use the Netty voidPromise instance owned by the channel to avoid allocation of an unused promise on each write operation to the Transport. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/d11e275b Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/d11e275b Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/d11e275b Branch: refs/heads/master Commit: d11e275b9db8dfcc96a658b915ab7786a0246aa3 Parents: 1baf3e2 Author: Francesco Nigro Authored: Sun Jun 24 16:10:15 2018 +0200 Committer: Timothy Bish Committed: Wed Jul 11 14:58:44 2018 -0400 -- .../org/apache/qpid/jms/transports/netty/NettyTcpTransport.java | 4 ++-- .../org/apache/qpid/jms/transports/netty/NettyWsTransport.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d11e275b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java index ab04a75..3c02cc9 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java @@ -265,14 +265,14 @@ public class NettyTcpTransport implements Transport { public void write(ByteBuf output) throws IOException { checkConnected(output); LOG.trace("Attempted write of: {} bytes", output.readableBytes()); -channel.write(output); +channel.write(output, channel.voidPromise()); } @Override public void writeAndFlush(ByteBuf output) throws IOException { checkConnected(output); LOG.trace("Attempted write and flush of: {} bytes", output.readableBytes()); -channel.writeAndFlush(output); +channel.writeAndFlush(output, channel.voidPromise()); } @Override http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d11e275b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java index 034dfc3..3da8784 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java @@ -94,7 +94,7 @@ public class NettyWsTransport extends NettyTcpTransport { LOG.trace("Attempted write of: {} bytes", length); -channel.write(new BinaryWebSocketFrame(output)); +channel.write(new BinaryWebSocketFrame(output), channel.voidPromise()); } @Override @@ -107,7 +107,7 @@ public class NettyWsTransport extends NettyTcpTransport { LOG.trace("Attempted write and flush of: {} bytes", length); -channel.writeAndFlush(new BinaryWebSocketFrame(output)); +channel.writeAndFlush(new BinaryWebSocketFrame(output), channel.voidPromise()); } @Override - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: QPIDJMS-401 Remove unneeded volatile tag on variable
Repository: qpid-jms Updated Branches: refs/heads/master d5be8518e -> f29284c6c QPIDJMS-401 Remove unneeded volatile tag on variable Removed volatile on the error member as it will be sync'd by the atomic update on the state when written. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/f29284c6 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/f29284c6 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/f29284c6 Branch: refs/heads/master Commit: f29284c6ccf74c9186cea35302c8896cc8089ac5 Parents: d5be851 Author: Timothy Bish Authored: Wed Jul 11 15:07:25 2018 -0400 Committer: Timothy Bish Committed: Wed Jul 11 15:07:25 2018 -0400 -- .../src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f29284c6/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java index c228a1f..e62db63 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java @@ -47,7 +47,7 @@ public class ProviderFuture implements AsyncResult { AtomicIntegerFieldUpdater.newUpdater(ProviderFuture.class,"state"); private volatile int state = INCOMPLETE; -private volatile Throwable error; +private Throwable error; private int waiting; - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: QPIDJMS-401 Refactor fixed producer send path
Repository: qpid-jms Updated Branches: refs/heads/master f29284c6c -> fa1334718 QPIDJMS-401 Refactor fixed producer send path Remove need for instanceof on each send call when the common case it that the send fires and we know what the type is. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/fa133471 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/fa133471 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/fa133471 Branch: refs/heads/master Commit: fa1334718e4b8a57748cc3db9022b560cd4443db Parents: f29284c Author: Timothy Bish Authored: Wed Jul 11 15:20:43 2018 -0400 Committer: Timothy Bish Committed: Wed Jul 11 15:20:43 2018 -0400 -- .../jms/provider/amqp/AmqpFixedProducer.java| 38 ++-- 1 file changed, 19 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fa133471/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java index 0f50b5c..4b2e5b1 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java @@ -107,18 +107,18 @@ public class AmqpFixedProducer extends AmqpProducer { blocked.put(envelope.getMessageId(), send); getParent().getProvider().pumpToProtonTransport(request); } else { -doSend(envelope, request); -} -} +// If the transaction has failed due to remote termination etc then we just indicate +// the send has succeeded until the a new transaction is started. +if (session.isTransacted() && session.isTransactionFailed()) { +request.onSuccess(); +return; +} -private void doSend(JmsOutboundMessageDispatch envelope, AsyncResult request) throws IOException, JMSException { -// If the transaction has failed due to remote termination etc then we just indicate -// the send has succeeded until the a new transaction is started. -if (session.isTransacted() && session.isTransactionFailed()) { -request.onSuccess(); -return; +doSend(envelope, new InFlightSend(envelope, request)); } +} +private void doSend(JmsOutboundMessageDispatch envelope, InFlightSend send) throws IOException, JMSException { LOG.trace("Producer sending message: {}", envelope); boolean presettle = envelope.isPresettle() || isPresettle(); @@ -143,15 +143,8 @@ public class AmqpFixedProducer extends AmqpProducer { AmqpProvider provider = getParent().getProvider(); -InFlightSend send = null; -if (request instanceof InFlightSend) { -send = (InFlightSend) request; -} else { -send = new InFlightSend(envelope, request); - -if (!presettle && getSendTimeout() != JmsConnectionInfo.INFINITE) { -send.requestTimeout = getParent().getProvider().scheduleRequestTimeout(send, getSendTimeout(), send); -} +if (!presettle && getSendTimeout() != JmsConnectionInfo.INFINITE && send.requestTimeout == null) { +send.requestTimeout = getParent().getProvider().scheduleRequestTimeout(send, getSendTimeout(), send); } if (presettle) { @@ -166,7 +159,7 @@ public class AmqpFixedProducer extends AmqpProducer { // Put it on the wire and let it fail if the connection is broken, if it does // get written then continue on to determine when we should complete it. -if (provider.pumpToProtonTransport(request, false)) { +if (provider.pumpToProtonTransport(send, false)) { // For presettled messages we can just mark as successful and we are done, but // for any other message we still track it until the remote settles. If the send // was tagged as asynchronous we must mark the original request as complete but @@ -190,6 +183,13 @@ public class AmqpFixedProducer extends AmqpProducer { LOG.trace("Dispatching previously held send"); InFlightSend held = blockedSends.next(); try { +// If the transaction has failed due to remote termination etc then we just indicate +// the send has succeeded until the a new transaction is started. +if (session.isTransacted() && session.isTransactionFailed()) { +
qpid-jms git commit: QPIDJMS-401 Clean up some older code in the AMQP provider
Repository: qpid-jms Updated Branches: refs/heads/master fa1334718 -> a21542cca QPIDJMS-401 Clean up some older code in the AMQP provider Remove some now unused code paths and tests that no longer apply to how we manage consumer and producer resources. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/a21542cc Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/a21542cc Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/a21542cc Branch: refs/heads/master Commit: a21542cca7ca3098f03e9f7441fea5d23a1cd42e Parents: fa13347 Author: Timothy Bish Authored: Thu Jul 12 12:33:52 2018 -0400 Committer: Timothy Bish Committed: Thu Jul 12 12:33:52 2018 -0400 -- .../qpid/jms/provider/amqp/AmqpProvider.java| 36 .../qpid/jms/provider/amqp/AmqpSession.java | 11 +++--- 2 files changed, 10 insertions(+), 37 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a21542cc/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java index 890ebdb..a4dbc39 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java @@ -89,7 +89,6 @@ import org.slf4j.LoggerFactory; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; -import io.netty.util.ReferenceCountUtil; /** * An AMQP v1.0 Provider. @@ -633,17 +632,8 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP public void run() { try { checkClosedOrFailed(); - JmsProducerId producerId = envelope.getProducerId(); -AmqpProducer producer = null; - -if (producerId.getProviderHint() instanceof AmqpFixedProducer) { -producer = (AmqpFixedProducer) producerId.getProviderHint(); -} else { -AmqpSession session = connection.getSession(producerId.getParentId()); -producer = session.getProducer(producerId); -} - +AmqpProducer producer = (AmqpProducer) producerId.getProviderHint(); producer.send(envelope, request); } catch (Throwable t) { request.onFailure(t); @@ -683,14 +673,7 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP checkClosedOrFailed(); JmsConsumerId consumerId = envelope.getConsumerId(); -AmqpConsumer consumer = null; - -if (consumerId.getProviderHint() instanceof AmqpConsumer) { -consumer = (AmqpConsumer) consumerId.getProviderHint(); -} else { -AmqpSession session = connection.getSession(consumerId.getParentId()); -consumer = session.getConsumer(consumerId); -} +AmqpConsumer consumer = (AmqpConsumer) consumerId.getProviderHint(); consumer.acknowledge(envelope, ackType); @@ -794,15 +777,7 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP public void run() { try { checkClosedOrFailed(); -AmqpConsumer consumer = null; - -if (consumerId.getProviderHint() instanceof AmqpConsumer) { -consumer = (AmqpConsumer) consumerId.getProviderHint(); -} else { -AmqpSession session = connection.getSession(consumerId.getParentId()); -consumer = session.getConsumer(consumerId); -} - +AmqpConsumer consumer = (AmqpConsumer) consumerId.getProviderHint(); consumer.pull(timeout, request); pumpToProtonTransport(request); } catch (Throwable t) { @@ -834,7 +809,7 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP public void onData(final ByteBuf input) { // We need to retain until the serializer gets around to processing it. -ReferenceCountUtil.retain(input); +input.retain(); serializer.execute(new Runnable() { @@ -853,7 +828,8 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP
qpid-jms git commit: QPIDJMS-403 Trigger whenOffline event on queued requests on drop
Repository: qpid-jms Updated Branches: refs/heads/master a21542cca -> 3244adc3a QPIDJMS-403 Trigger whenOffline event on queued requests on drop When the handle connection failure method runs it should trigger the when off line behavior of any currently queued tasks in order to allow timely completion of requests that do not need to wait for a new connection to happen such as session close, message acknowledge etc. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/3244adc3 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/3244adc3 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/3244adc3 Branch: refs/heads/master Commit: 3244adc3adf14e90f0367df683f672a0b4e87d80 Parents: a21542c Author: Timothy Bish Authored: Tue Jul 17 17:17:20 2018 -0400 Committer: Timothy Bish Committed: Tue Jul 17 17:17:20 2018 -0400 -- .../jms/provider/failover/FailoverProvider.java | 6 ++ .../failover/FailoverIntegrationTest.java | 64 2 files changed, 70 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/3244adc3/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java index 2f85ccd..b48f4c9 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java @@ -554,6 +554,12 @@ public class FailoverProvider extends DefaultProviderListener implements Provide if (listener != null) { listener.onConnectionInterrupted(failedURI); } + +if (!requests.isEmpty()) { + for (FailoverRequest request : requests.values()) { + request.whenOffline(cause); + } +} // Start watching for request timeouts while we are offline, unless we already are. if (requestTimeoutTask == null) { http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/3244adc3/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index d9f5713..4e3128e 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -1141,6 +1141,70 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { } @Test(timeout = 2) +public void testFailoverHandlesDropAfterSessionCloseRequested() throws Exception { +try (TestAmqpPeer originalPeer = new TestAmqpPeer()) { + +final CountDownLatch originalConnected = new CountDownLatch(1); + +final String originalURI = createPeerURI(originalPeer); + +LOG.info("Original peer is at: {}", originalURI); + +// Connect to the first peer +originalPeer.expectSaslAnonymous(); +originalPeer.expectOpen(); +originalPeer.expectBegin(); + +final JmsConnection connection = establishAnonymousConnecton(originalPeer); +connection.addConnectionListener(new JmsDefaultConnectionListener() { +@Override +public void onConnectionEstablished(URI remoteURI) { +LOG.info("Connection Established: {}", remoteURI); +if (originalURI.equals(remoteURI.toString())) { +originalConnected.countDown(); +} +} +}); +connection.start(); + +assertTrue("Should connect to original peer", originalConnected.await(5, TimeUnit.SECONDS)); + +originalPeer.expectBegin(); +originalPeer.expectEnd(false); +originalPeer.dropAfterLastHandler(); + +Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + +final CountDownLatch sessionCloseCompleted = new CountDownLatch(1); +final AtomicBoolean sessionClosedThrew = new AtomicBoolean(); +Thread sessionCloseThread = new Thread(new Runnable() { +
[1/2] qpid-jms git commit: QPIDJMS-404 Add variants of ProviderFuture for perf tuning
Repository: qpid-jms Updated Branches: refs/heads/master 8b200671e -> 264a9a9b6 http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/264a9a9b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java index 19b8d25..e5291d9 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java @@ -47,6 +47,7 @@ import org.apache.qpid.jms.meta.JmsProducerInfo; import org.apache.qpid.jms.meta.JmsSessionInfo; import org.apache.qpid.jms.provider.DefaultProviderListener; import org.apache.qpid.jms.provider.ProviderFuture; +import org.apache.qpid.jms.provider.ProviderFutureFactory; import org.apache.qpid.jms.test.Wait; import org.junit.After; import org.junit.Before; @@ -61,6 +62,8 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { private static final Logger LOG = LoggerFactory.getLogger(FailoverProviderTest.class); +private final ProviderFutureFactory futuresFactory = ProviderFutureFactory.create(Collections.emptyMap()); + private List uris; private FailoverProvider provider; private JmsConnectionInfo connection; @@ -91,7 +94,7 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { @Test(timeout = 3) public void testCreateProviderOnlyUris() { -provider = new FailoverProvider(uris); +provider = new FailoverProvider(uris, futuresFactory); assertEquals(FailoverUriPool.DEFAULT_RANDOMIZE_ENABLED, provider.isRandomize()); assertNull(provider.getRemoteURI()); assertNotNull(provider.getNestedOptions()); @@ -103,7 +106,7 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { Map options = new HashMap(); options.put("transport.tcpNoDelay", "true"); -provider = new FailoverProvider(options); +provider = new FailoverProvider(options, futuresFactory); assertEquals(FailoverUriPool.DEFAULT_RANDOMIZE_ENABLED, provider.isRandomize()); assertNull(provider.getRemoteURI()); assertNotNull(provider.getNestedOptions()); @@ -113,7 +116,7 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { @Test(timeout = 3) public void testCreateProviderWithNestedOptions() { -provider = new FailoverProvider(uris, Collections.emptyMap()); +provider = new FailoverProvider(uris, Collections.emptyMap(), futuresFactory); assertEquals(FailoverUriPool.DEFAULT_RANDOMIZE_ENABLED, provider.isRandomize()); assertNull(provider.getRemoteURI()); assertNotNull(provider.getNestedOptions()); @@ -122,7 +125,7 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { @Test(timeout = 3) public void testProviderListener() { -provider = new FailoverProvider(uris, Collections.emptyMap()); +provider = new FailoverProvider(uris, Collections.emptyMap(), futuresFactory); assertNull(provider.getProviderListener()); provider.setProviderListener(new DefaultProviderListener()); assertNotNull(provider.getProviderListener()); @@ -130,7 +133,7 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { @Test(timeout = 3) public void testGetRemoteURI() throws Exception { -provider = new FailoverProvider(uris, Collections.emptyMap()); +provider = new FailoverProvider(uris, Collections.emptyMap(), futuresFactory); assertNull(provider.getRemoteURI()); provider.connect(connection); @@ -145,7 +148,7 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { @Test(timeout = 3) public void testToString() throws Exception { -provider = new FailoverProvider(uris, Collections.emptyMap()); +provider = new FailoverProvider(uris, Collections.emptyMap(), futuresFactory); assertNotNull(provider.toString()); provider.connect(connection); @@ -161,7 +164,7 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { @Test(timeout = 3) public void testConnectToMock() throws Exception { -provider = new FailoverProvider(uris, Collections.emptyMap()); +provider = new FailoverProvider(uris, Collections.emptyMap(), futuresFactory); assertEquals(FailoverUriPool.DEFAULT_RANDOMIZE_ENABLED, provider.isRandomize()); assertNull(provider.getRemoteURI()); @@ -177,7 +180,7 @@ public class FailoverProviderTest extends FailoverProviderTestSupport { provider.connect(connection);
[2/2] qpid-jms git commit: QPIDJMS-404 Add variants of ProviderFuture for perf tuning
QPIDJMS-404 Add variants of ProviderFuture for perf tuning Adds three variations on ProviderFuture that allow for tuning on platforms that don't benefit from the spin / wait pattern used in the current implementation and default to using a variant that does not park on windows to avoid unpredictably long parks that result in performance decreases due to missing the event completion. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/264a9a9b Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/264a9a9b Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/264a9a9b Branch: refs/heads/master Commit: 264a9a9b6c5d8d8c11a995b7b02289b2938d77ba Parents: 8b20067 Author: Timothy Bish Authored: Wed Jul 18 12:11:53 2018 -0400 Committer: Timothy Bish Committed: Wed Jul 18 12:37:35 2018 -0400 -- .../java/org/apache/qpid/jms/JmsConnection.java | 34 ++-- .../qpid/jms/JmsLocalTransactionContext.java| 2 +- .../org/apache/qpid/jms/JmsMessageConsumer.java | 4 +- .../org/apache/qpid/jms/JmsMessageProducer.java | 2 +- .../java/org/apache/qpid/jms/JmsSession.java| 2 +- .../jms/provider/BalancedProviderFuture.java| 149 .../provider/ConservativeProviderFuture.java| 128 ++ .../jms/provider/ProgressiveProviderFuture.java | 167 ++ .../org/apache/qpid/jms/provider/Provider.java | 22 +++ .../qpid/jms/provider/ProviderFactory.java | 34 +++- .../qpid/jms/provider/ProviderFuture.java | 165 ++--- .../jms/provider/ProviderFutureFactory.java | 176 +++ .../qpid/jms/provider/ProviderWrapper.java | 10 ++ .../qpid/jms/provider/amqp/AmqpProvider.java| 30 ++-- .../jms/provider/amqp/AmqpProviderFactory.java | 32 +++- .../jms/provider/failover/FailoverProvider.java | 28 ++- .../failover/FailoverProviderFactory.java | 24 ++- .../jms/provider/ProviderFutureFactoryTest.java | 105 +++ .../qpid/jms/provider/ProviderFutureTest.java | 44 +++-- .../jms/provider/WrappedAsyncResultTest.java| 9 +- .../jms/provider/amqp/AmqpProviderTest.java | 6 +- .../failover/FailoverProviderClosedTest.java| 28 +-- .../provider/failover/FailoverProviderTest.java | 31 ++-- .../qpid/jms/provider/mock/MockProvider.java| 18 +- .../jms/provider/mock/MockProviderFactory.java | 28 ++- .../discovery/DiscoveryProviderFactory.java | 25 ++- 26 files changed, 1061 insertions(+), 242 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/264a9a9b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index 7d09a9c..bb456fe 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -214,7 +214,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection } if (isConnected() && !isFailed()) { -ProviderFuture request = new ProviderFuture(); +ProviderFuture request = provider.newProviderFuture(); requests.put(request, request); try { provider.destroy(connectionInfo, request); @@ -684,7 +684,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection checkClosedOrFailed(); try { -ProviderFuture request = new ProviderFuture(synchronization); +ProviderFuture request = provider.newProviderFuture(synchronization); requests.put(request, request); try { provider.create(resource, request); @@ -705,7 +705,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection checkClosedOrFailed(); try { -ProviderFuture request = new ProviderFuture(synchronization); +ProviderFuture request = provider.newProviderFuture(synchronization); requests.put(request, request); try { provider.start(resource, request); @@ -726,7 +726,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection checkClosedOrFailed(); try { -ProviderFuture request = new ProviderFuture(synchronization); +ProviderFuture request = provider.newProviderFuture(synchronization); requests.put(request, request); try { provider.stop(resource, request); @@ -747,7 +747,7 @@ pub
qpid-jms git commit: QPIDJMS-398 Update Mockito to latest point release
Repository: qpid-jms Updated Branches: refs/heads/master 264a9a9b6 -> 8eb19c156 QPIDJMS-398 Update Mockito to latest point release Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/8eb19c15 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/8eb19c15 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/8eb19c15 Branch: refs/heads/master Commit: 8eb19c156a0979c18bfe5134b3d70ab10cf74454 Parents: 264a9a9 Author: Timothy Bish Authored: Wed Jul 18 13:07:27 2018 -0400 Committer: Timothy Bish Committed: Wed Jul 18 13:07:27 2018 -0400 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8eb19c15/pom.xml -- diff --git a/pom.xml b/pom.xml index ee0c1da..54e3f61 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 4.12 1.0 9.4.11.v20180605 -2.19.0 +2.19.1 1.3 2.9.0 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: NO-JIRA Ensure connection not dropped until listener is set
Repository: qpid-jms Updated Branches: refs/heads/master 965f989d3 -> b103810ba NO-JIRA Ensure connection not dropped until listener is set Make the consumer a zero prefetch consumer so that the flow isn't emitted until the message listener is set so the connection isn't dropped until the test is in the correct state to manage the outcome. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/b103810b Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/b103810b Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/b103810b Branch: refs/heads/master Commit: b103810babeed2cce9723d4dde5523ec7d446e9d Parents: 965f989 Author: Timothy Bish Authored: Wed Jul 18 15:14:10 2018 -0400 Committer: Timothy Bish Committed: Wed Jul 18 15:14:10 2018 -0400 -- .../failover/FailoverIntegrationTest.java | 35 ++-- 1 file changed, 18 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b103810b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index 7297e81..c38ba8d 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -1174,24 +1174,24 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { originalPeer.dropAfterLastHandler(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - + final CountDownLatch sessionCloseCompleted = new CountDownLatch(1); final AtomicBoolean sessionClosedThrew = new AtomicBoolean(); Thread sessionCloseThread = new Thread(new Runnable() { - - @Override - public void run() { - try { - session.close(); - LOG.debug("Close of session returned ok"); - } catch (JMSException jmsEx) { - LOG.warn("Should not throw on session close when connection drops.", jmsEx); - sessionClosedThrew.set(true); - } finally { - sessionCloseCompleted.countDown(); - } - } - }, "Session close thread"); + +@Override +public void run() { +try { +session.close(); +LOG.debug("Close of session returned ok"); +} catch (JMSException jmsEx) { +LOG.warn("Should not throw on session close when connection drops.", jmsEx); +sessionClosedThrew.set(true); +} finally { +sessionCloseCompleted.countDown(); +} +} +}, "Session close thread"); sessionCloseThread.start(); @@ -1199,7 +1199,7 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { assertTrue("Session close should have completed by now", sessionCloseCompleted.await(3, TimeUnit.SECONDS)); assertFalse("Session close should have completed normally", sessionClosedThrew.get()); - + connection.close(); } } @@ -2637,7 +2637,8 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { finalPeer.expectReceiverAttach(notNullValue(), notNullValue(), false, true, false, false, errorCondition, errorDescription); finalPeer.expectDetach(true, false, false); -final JmsConnection connection = establishAnonymousConnecton("jms.closeLinksThatFailOnReconnect=true", originalPeer, finalPeer); +final JmsConnection connection = establishAnonymousConnecton( + "jms.prefetchPolicy.all=0&jms.closeLinksThatFailOnReconnect=true", originalPeer, finalPeer); connection.setExceptionListener(new ExceptionListener() { @Override public void onException(JMSException exception) { - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: NO-JIRA Fix test to account for so that flow is emitted always
Repository: qpid-jms Updated Branches: refs/heads/master b103810ba -> fea02ac5c NO-JIRA Fix test to account for so that flow is emitted always For the no listener case we should emit a flow so that the two cases are consistent. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/fea02ac5 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/fea02ac5 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/fea02ac5 Branch: refs/heads/master Commit: fea02ac5cd2e25de24c68c12c27914de2884d3c0 Parents: b103810 Author: Timothy Bish Authored: Wed Jul 18 15:23:55 2018 -0400 Committer: Timothy Bish Committed: Wed Jul 18 15:23:55 2018 -0400 -- .../qpid/jms/provider/failover/FailoverIntegrationTest.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fea02ac5/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index c38ba8d..0a80741 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -2637,8 +2637,15 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { finalPeer.expectReceiverAttach(notNullValue(), notNullValue(), false, true, false, false, errorCondition, errorDescription); finalPeer.expectDetach(true, false, false); +final int prefetch; +if (addListener) { +prefetch = 0; +} else { +prefetch = 1; +} + final JmsConnection connection = establishAnonymousConnecton( - "jms.prefetchPolicy.all=0&jms.closeLinksThatFailOnReconnect=true", originalPeer, finalPeer); +"jms.prefetchPolicy.all="+ prefetch + "&jms.closeLinksThatFailOnReconnect=true", originalPeer, finalPeer); connection.setExceptionListener(new ExceptionListener() { @Override public void onException(JMSException exception) { - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[2/2] qpid-jms git commit: QPIDJMS-391 Add support for netty OpenSSL implementations
QPIDJMS-391 Add support for netty OpenSSL implementations Allow the client to utilize netty openssl features if available and configured to do so. The user will need to provide a netty-tcnative dependency to the classpath such as the boringssl uber jar and set the transport.useOpenSSL option to true. The tests use the boringssl library v2.0.12.Final to validate. Updates to Netty 4.1.28.Final which has some OpenSSL bindings fixes. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/d5cde3ed Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/d5cde3ed Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/d5cde3ed Branch: refs/heads/master Commit: d5cde3ed4de43d5c2462930a068da15afa916d1d Parents: 994c5b4 Author: Timothy Bish Authored: Thu Aug 2 16:35:58 2018 -0400 Committer: Timothy Bish Committed: Thu Aug 2 16:35:58 2018 -0400 -- pom.xml | 9 +- qpid-jms-client/pom.xml | 5 + .../qpid/jms/transports/TransportOptions.java | 18 + .../qpid/jms/transports/TransportSupport.java | 216 +-- .../jms/transports/netty/NettyTcpTransport.java | 25 +- .../jms/integration/SaslIntegrationTest.java| 4 +- .../jms/integration/SslIntegrationTest.java | 97 ++- ...qpOpenProvidedServerListIntegrationTest.java | 14 +- .../jms/transports/TransportSupportTest.java| 633 +-- .../netty/NettyOpenSSLWssTransportTest.java | 42 ++ .../netty/NettyOpenSslTransportTest.java| 213 +++ .../qpid/jms/transports/netty/NettyServer.java | 4 +- .../transports/netty/NettySslTransportTest.java | 5 +- .../apache/qpid/jms/JmsSSLConnectionTest.java | 2 +- .../apache/qpid/jms/JmsWSSConnectionTest.java | 2 +- 15 files changed, 1129 insertions(+), 160 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d5cde3ed/pom.xml -- diff --git a/pom.xml b/pom.xml index 91310f4..f607c00 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,8 @@ 0.28.0 -4.1.27.Final +4.1.28.Final +2.0.12.Final 1.7.25 1.0-alpha-2 @@ -156,6 +157,12 @@ netty-codec-http ${netty-version} + + + io.netty + netty-tcnative-boringssl-static + ${netty-tcnative-version} + org.slf4j slf4j-api http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d5cde3ed/qpid-jms-client/pom.xml -- diff --git a/qpid-jms-client/pom.xml b/qpid-jms-client/pom.xml index de175d0..83e8557 100644 --- a/qpid-jms-client/pom.xml +++ b/qpid-jms-client/pom.xml @@ -103,6 +103,11 @@ hadoop-minikdc test + + io.netty + netty-tcnative-boringssl-static + test + http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d5cde3ed/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java index 7cb520b..4a0f69c 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java @@ -47,6 +47,7 @@ public class TransportOptions implements Cloneable { public static final boolean DEFAULT_VERIFY_HOST = true; public static final List DEFAULT_DISABLED_PROTOCOLS = Collections.unmodifiableList(Arrays.asList(new String[]{"SSLv2Hello", "SSLv3"})); public static final int DEFAULT_SSL_PORT = 5671; +public static final boolean DEFAULT_USE_OPENSSL = false; private static final String JAVAX_NET_SSL_KEY_STORE = "javax.net.ssl.keyStore"; private static final String JAVAX_NET_SSL_KEY_STORE_TYPE = "javax.net.ssl.keyStoreType"; @@ -67,6 +68,7 @@ public class TransportOptions implements Cloneable { private boolean useEpoll = DEFAULT_USE_EPOLL; private boolean useKQueue = DEFAULT_USE_KQUEUE; private boolean traceBytes = DEFAULT_TRACE_BYTES; +private boolean useOpenSSL = DEFAULT_USE_OPENSSL; private String keyStoreLocation; private String keyStorePassword; @@ -512,6 +514,21 @@ public class TransportOptions implements Cloneable { return httpHeaders; } +/** + * @return true if OpenSSL support is enabled for this Transport. + */ +public boolean isUseOpenSSL() { +return useOpenSSL; +} + +/** + * @param useOpenSSL + * Configure if the transport
[1/2] qpid-jms git commit: QPIDJMS-391 Add support for netty OpenSSL implementations
Repository: qpid-jms Updated Branches: refs/heads/master 994c5b464 -> d5cde3ed4 http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d5cde3ed/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyOpenSslTransportTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyOpenSslTransportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyOpenSslTransportTest.java new file mode 100644 index 000..a0696da --- /dev/null +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyOpenSslTransportTest.java @@ -0,0 +1,213 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.qpid.jms.transports.netty; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; + +import java.lang.reflect.Field; +import java.net.URI; + +import javax.net.ssl.SSLContext; + +import org.apache.qpid.jms.transports.Transport; +import org.apache.qpid.jms.transports.TransportOptions; +import org.apache.qpid.jms.transports.TransportSupport; +import org.apache.qpid.jms.util.QpidJMSTestRunner; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandler; +import io.netty.handler.ssl.OpenSsl; +import io.netty.handler.ssl.OpenSslEngine; +import io.netty.handler.ssl.SslHandler; + +/** + * Test basic functionality of the Netty based TCP Transport ruuing in secure mode (SSL). + */ +@RunWith(QpidJMSTestRunner.class) +public class NettyOpenSslTransportTest extends NettySslTransportTest { + +private static final Logger LOG = LoggerFactory.getLogger(NettyOpenSslTransportTest.class); + +@Test(timeout = 240 * 1000) +public void testConnectToServerWithOpenSSLEnabled() throws Exception { +doTestOpenSSLSupport(true); +} + +@Test(timeout = 60 * 1000) +public void testConnectToServerWithOpenSSLDisabled() throws Exception { +doTestOpenSSLSupport(false); +} + +private void doTestOpenSSLSupport(boolean useOpenSSL) throws Exception { +assumeTrue(OpenSsl.isAvailable()); +assumeTrue(OpenSsl.supportsKeyManagerFactory()); + +try (NettyEchoServer server = createEchoServer(createServerOptions())) { +server.start(); + +int port = server.getServerPort(); +URI serverLocation = new URI("tcp://localhost:" + port); + +TransportOptions options = createClientOptions(); +options.setUseOpenSSL(useOpenSSL); + +Transport transport = createTransport(serverLocation, testListener, options); +try { +transport.connect(null); +LOG.info("Connected to server:{} as expected.", serverLocation); +} catch (Exception e) { +fail("Should have connected to the server at " + serverLocation + " but got exception: " + e); +} + +assertTrue(transport.isConnected()); +assertEquals(serverLocation, transport.getRemoteLocation()); +assertOpenSSL("Transport should be using OpenSSL", useOpenSSL, transport); + +transport.close(); + +// Additional close should not fail or cause other problems. +transport.close(); +} + +assertTrue(!transportClosed); // Normal shutdown does not trigger the event. +assertTrue(exceptions.isEmpty()); +assertTrue(data.isEmpty()); +} + +@Test(timeout = 60 * 1000) +public void testConnectToServerWithUserSppliedSSLContextWorksWhenOpenSSLRequested() throws Exception { +assumeTrue(OpenSsl.isAvailable()); +assumeTrue(OpenSsl.supportsKeyManagerFactory()); + +try (NettyEchoServer server = createEchoServer(createServerOptions())) { +server.start(); + +int port = server.getServerPo
qpid-jms git commit: QPIDJMS-407 Address thread unsafe failover requests handling
Repository: qpid-jms Updated Branches: refs/heads/master e2e0cee97 -> fe90adaf2 QPIDJMS-407 Address thread unsafe failover requests handling Address thread unsafe handling of in progress requests being added and removed from the request tracking map that lead to issues on reconnect and recover losing track of pending requests. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/fe90adaf Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/fe90adaf Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/fe90adaf Branch: refs/heads/master Commit: fe90adaf2f63444c09ddb6b058f03568cacb04ef Parents: e2e0cee Author: Timothy Bish Authored: Wed Aug 8 09:56:21 2018 -0400 Committer: Timothy Bish Committed: Wed Aug 8 09:56:21 2018 -0400 -- .../jms/provider/failover/FailoverProvider.java | 49 ++-- 1 file changed, 35 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fe90adaf/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java index 654ec48..ad4752c 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.ConcurrentModificationException; import java.util.LinkedHashMap; import java.util.List; @@ -99,7 +100,7 @@ public class FailoverProvider extends DefaultProviderListener implements Provide private final AtomicBoolean failed = new AtomicBoolean(); private final AtomicBoolean closingConnection = new AtomicBoolean(false); private final AtomicLong requestId = new AtomicLong(); -private final Map requests = new LinkedHashMap(); +private final Map requests = Collections.synchronizedMap(new LinkedHashMap()); private final DefaultProviderListener closedListener = new DefaultProviderListener(); private final AtomicReference messageFactory = new AtomicReference(); private final ProviderFutureFactory futureFactory; @@ -178,9 +179,14 @@ public class FailoverProvider extends DefaultProviderListener implements Provide public void run() { try { IOException error = failureCause != null ? failureCause : new IOException("Connection closed"); -List pending = new ArrayList(requests.values()); +final List pending; +synchronized (requests) { +pending = new ArrayList(requests.values()); +} for (FailoverRequest request : pending) { -request.onFailure(error); +if (!request.isComplete()) { +request.onFailure(error); +} } if (requestTimeoutTask != null) { @@ -558,11 +564,13 @@ public class FailoverProvider extends DefaultProviderListener implements Provide if (listener != null) { listener.onConnectionInterrupted(failedURI); } - -if (!requests.isEmpty()) { - for (FailoverRequest request : requests.values()) { - request.whenOffline(cause); - } + +final List pending; +synchronized (requests) { +pending = new ArrayList(requests.values()); +} +for (FailoverRequest request : pending) { +request.whenOffline(cause); } // Start watching for request timeouts while we are offline, unless we already are. @@ -626,9 +634,14 @@ public class FailoverProvider extends DefaultProviderListener implements Provide listener.onConnectionRestored(provider.getRemoteURI()); // Last step: Send pending actions. -List pending = new ArrayList(requests.values()); +final List pending; +synchronized (requests) { +pending = new ArrayList(requests.values()); +} for (Failove
qpid-jms git commit: NO-JIRA Bind the AMQP connector to localhost only
Repository: qpid-jms Updated Branches: refs/heads/master fe90adaf2 -> 6040fade6 NO-JIRA Bind the AMQP connector to localhost only Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/6040fade Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/6040fade Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/6040fade Branch: refs/heads/master Commit: 6040fade630ef2acbbbc3d4ff104079965b33835 Parents: fe90ada Author: Timothy Bish Authored: Wed Aug 8 10:38:11 2018 -0400 Committer: Timothy Bish Committed: Wed Aug 8 10:38:11 2018 -0400 -- .../src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6040fade/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java -- diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java index a9c646b..1ee82c2 100644 --- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java +++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java @@ -81,7 +81,7 @@ public class AmqpTestSupport extends QpidJmsTestSupport { port = portMap.get("amqp"); } TransportConnector connector = brokerService.addConnector( -"amqp://0.0.0.0:" + port + +"amqp://127.0.0.1:" + port + "?transport.transformer=" + getAmqpTransformer() + "&transport.socketBufferSize=" + getSocketBufferSize() + "&transport.tcpNoDelay=true" + - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton-j git commit: PROTON-1911 Improve performance of String encodes when possible
Repository: qpid-proton-j Updated Branches: refs/heads/master 7484cc8e4 -> 7eac8b945 PROTON-1911 Improve performance of String encodes when possible Optimize the String encoding by adding new method to WritableBuffer that allows the buffer implementation to optimize how String values are encoded to UTF8 bytes based on the buffer type. Using the Java 8 default implementation support for interface methods add a default version that behaves as the older releases would. For the ByteBuffer wrapper optimize the writes by accessing the buffer data in the most direct way possible. Help on this solution provided by Robbie Gemmell and Francesco Nigro Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/7eac8b94 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/7eac8b94 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/7eac8b94 Branch: refs/heads/master Commit: 7eac8b945c8ce90f091126d34cf174e8792fdfc0 Parents: 7484cc8 Author: Timothy Bish Authored: Fri Aug 10 12:40:12 2018 -0400 Committer: Timothy Bish Committed: Fri Aug 10 12:40:12 2018 -0400 -- .../proton/codec/CompositeWritableBuffer.java | 31 +++- .../proton/codec/DroppingWritableBuffer.java| 10 +- .../apache/qpid/proton/codec/EncoderImpl.java | 93 ++-- .../qpid/proton/codec/WritableBuffer.java | 151 +-- .../org/apache/qpid/proton/codec/Benchmark.java | 13 +- .../qpid/proton/codec/StringTypeTest.java | 130 ++-- 6 files changed, 315 insertions(+), 113 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/7eac8b94/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeWritableBuffer.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeWritableBuffer.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeWritableBuffer.java index 5b2c71c..7d1fef2 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeWritableBuffer.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeWritableBuffer.java @@ -1,4 +1,3 @@ -package org.apache.qpid.proton.codec; /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -19,9 +18,10 @@ package org.apache.qpid.proton.codec; * under the License. * */ - +package org.apache.qpid.proton.codec; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; public class CompositeWritableBuffer implements WritableBuffer { @@ -34,21 +34,25 @@ public class CompositeWritableBuffer implements WritableBuffer _second = second; } +@Override public void put(byte b) { (_first.hasRemaining() ? _first : _second).put(b); } +@Override public void putFloat(float f) { putInt(Float.floatToRawIntBits(f)); } +@Override public void putDouble(double d) { putLong(Double.doubleToRawLongBits(d)); } +@Override public void putShort(short s) { int remaining = _first.remaining(); @@ -69,6 +73,7 @@ public class CompositeWritableBuffer implements WritableBuffer } } +@Override public void putInt(int i) { int remaining = _first.remaining(); @@ -89,6 +94,7 @@ public class CompositeWritableBuffer implements WritableBuffer } } +@Override public void putLong(long l) { int remaining = _first.remaining(); @@ -109,26 +115,31 @@ public class CompositeWritableBuffer implements WritableBuffer } } +@Override public boolean hasRemaining() { return _first.hasRemaining() || _second.hasRemaining(); } +@Override public int remaining() { return _first.remaining()+_second.remaining(); } +@Override public int position() { return _first.position()+_second.position(); } +@Override public int limit() { return _first.limit() + _second.limit(); } +@Override public void position(int position) { int first_limit = _first.limit(); @@ -144,6 +155,7 @@ public class CompositeWritableBuffer implements WritableBuffer } } +@Override public void put(byte[] src, int offset, int length) { final int firstRemaining = _first.remaining(); @@ -162,6 +174,7 @@ public class CompositeWritableBuffer implements WritableBuffer _second.put(src, offset+firstRemaining, length-firstRemaining); } +@Override public void put(ByteBuffer payload) { int firstRemaining = _first.remaining(); @@ -209,4 +222,18 @@ public class CompositeWritableBuffer implements Wri
qpid-jms git commit: QPIDJMS-408 Implement the string write method of WritableBuffer
Repository: qpid-jms Updated Branches: refs/heads/master e72a72c9d -> c5c90534c QPIDJMS-408 Implement the string write method of WritableBuffer Implement the put(String) method for the WritableBuffer interface introduced in proton-j 0.29.0 which allows us to use the Netty ByteBuf string encoding to perform string encodes faster than the default version in proton-j Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/c5c90534 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/c5c90534 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/c5c90534 Branch: refs/heads/master Commit: c5c90534c2a761cd32e2462b942d00b420a7358d Parents: e72a72c Author: Timothy Bish Authored: Tue Aug 14 14:33:33 2018 -0400 Committer: Timothy Bish Committed: Tue Aug 14 14:33:33 2018 -0400 -- .../jms/provider/amqp/message/AmqpWritableBuffer.java | 6 ++ .../provider/amqp/message/AmqpWritableBufferTest.java | 14 ++ 2 files changed, 20 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c5c90534/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBuffer.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBuffer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBuffer.java index 77bb253..2f52bff 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBuffer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBuffer.java @@ -17,6 +17,7 @@ package org.apache.qpid.jms.provider.amqp.message; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import org.apache.qpid.proton.codec.ReadableBuffer; import org.apache.qpid.proton.codec.WritableBuffer; @@ -90,6 +91,11 @@ public class AmqpWritableBuffer implements WritableBuffer { } @Override +public void put(String value) { +nettyBuffer.writeCharSequence(value, StandardCharsets.UTF_8); +} + +@Override public boolean hasRemaining() { return nettyBuffer.writerIndex() < nettyBuffer.maxCapacity(); } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c5c90534/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBufferTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBufferTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBufferTest.java index 981556d..30a17e3 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBufferTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpWritableBufferTest.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import org.apache.qpid.proton.codec.ReadableBuffer; import org.junit.Test; @@ -120,6 +121,19 @@ public class AmqpWritableBufferTest { } @Test +public void testPutString() { +String ascii = new String("ASCII"); + +ByteBuf buffer = Unpooled.buffer(1024); +AmqpWritableBuffer writable = new AmqpWritableBuffer(buffer); + +assertEquals(0, writable.position()); +writable.put(ascii); +assertEquals(ascii.length(), writable.position()); +assertEquals(ascii, writable.getBuffer().toString(StandardCharsets.UTF_8)); +} + +@Test public void testPutReadableBuffer() { doPutReadableBufferTestImpl(true); doPutReadableBufferTestImpl(false); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: QPIDJMS-391 Add new documentation to cover OpenSSL support
Repository: qpid-jms Updated Branches: refs/heads/master b9e5ed34c -> 148436e72 QPIDJMS-391 Add new documentation to cover OpenSSL support Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/148436e7 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/148436e7 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/148436e7 Branch: refs/heads/master Commit: 148436e7206aa47e1e607832084c428ab8bb7815 Parents: b9e5ed3 Author: Timothy Bish Authored: Wed Aug 15 12:31:44 2018 -0400 Committer: Timothy Bish Committed: Wed Aug 15 12:31:44 2018 -0400 -- qpid-jms-docs/Configuration.md | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/148436e7/qpid-jms-docs/Configuration.md -- diff --git a/qpid-jms-docs/Configuration.md b/qpid-jms-docs/Configuration.md index 2a05949..ee51c44 100644 --- a/qpid-jms-docs/Configuration.md +++ b/qpid-jms-docs/Configuration.md @@ -175,7 +175,7 @@ The complete set of SSL Transport options is listed below: + **transport.keyStoreType** The type of keyStore being used. Default is to read from the system property "javax.net.ssl.keyStoreType" If not set then default is "JKS". + **transport.trustStoreType** The type of trustStore being used. Default is to read from the system property "javax.net.ssl.trustStoreType" If not set then default is "JKS". + **transport.storeType** This will set both the keystoreType and trustStoreType to the same value. If not set then the keyStoreType and trustStoreType will default to the values specified above. -+ **transport.contextProtocol** The protocol argument used when getting an SSLContext. Default is "TLS". ++ **transport.contextProtocol** The protocol argument used when getting an SSLContext. Default is TLS, or TLSv1.2 if using OpenSSL. + **transport.enabledCipherSuites** The cipher suites to enable, comma separated. No default, meaning the context default ciphers are used. Any disabled ciphers are removed from this. + **transport.disabledCipherSuites** The cipher suites to disable, comma separated. Ciphers listed here are removed from the enabled ciphers. No default. + **transport.enabledProtocols** The protocols to enable, comma separated. No default, meaning the context default protocols are used. Any disabled protocols are removed from this. @@ -183,6 +183,7 @@ The complete set of SSL Transport options is listed below: + **transport.trustAll** Whether to trust the provided server certificate implicitly, regardless of any configured trust store. Defaults to false. + **transport.verifyHost** Whether to verify that the hostname being connected to matches with the provided server certificate. Defaults to true. + **transport.keyAlias** The alias to use when selecting a keypair from the keystore if required to send a client certificate to the server. No default. ++ **transport.useOpenSSL** When true the transport will attempt to use native OpenSSL libraries for SSL connections if possible based on the SSL configuration and available OpenSSL libraries on the classpath. Refer to the section [Enabling OpenSSL support](#enabling-openssl-support) for more information. ### Websocket Transport Configuration options @@ -238,7 +239,6 @@ The failover URI also supports defining 'nested' options as a means of specifyin failover:(amqp://host1:5672,amqp://host2:5672)?jms.clientID=foo&failover.nested.amqp.vhost=myhost - ### Discovery Configuration options The client has an optional Discovery module, which provides a customised failover layer where the broker URIs to connect to are not given in the initial URI, but discovered as the client operates via associated discovery agents. There are currently two discovery agent implementations, a file watcher that loads URIs from a file, and a multicast listener that works with ActiveMQ 5 brokers which have been configured to broadcast their broker addresses for listening clients. @@ -266,6 +266,17 @@ The URI options for the multicast discovery agent are listed below: + **group** Controls which multicast group messages are listened for on. The default value is "default". +### Enabling OpenSSL support + +SSL connections can be configured to use a native OpenSSL implementation which can provide increased performance. To use this support the transport ***useOpenSSL*** option must be enabled and the OpenSSL support libraries must be configured on the classpath. The client tests make use of an uber jar containing static libraries for multiple platforms based on Google's boringssl project libraries. To include this dependency in your own project you might include the maven dependency as follows: + +
qpid-jms git commit: QPIDJMS-411 Improve output of amqp.traceFrames with payload
Repository: qpid-jms Updated Branches: refs/heads/master 495e27dcc -> b1b417ed8 QPIDJMS-411 Improve output of amqp.traceFrames with payload Output payload as formatted string with truncation (configuration of length added). Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/b1b417ed Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/b1b417ed Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/b1b417ed Branch: refs/heads/master Commit: b1b417ed8b4dfac096872cf2706e33282f1a064e Parents: 495e27d Author: Timothy Bish Authored: Thu Aug 16 12:36:11 2018 -0400 Committer: Timothy Bish Committed: Thu Aug 16 12:36:11 2018 -0400 -- .../jms/provider/amqp/AmqpProtocolTracer.java | 102 +++ .../qpid/jms/provider/amqp/AmqpProvider.java| 23 ++--- .../src/test/resources/log4j.properties | 2 + 3 files changed, 114 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b1b417ed/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProtocolTracer.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProtocolTracer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProtocolTracer.java new file mode 100644 index 000..b1fdc4e --- /dev/null +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProtocolTracer.java @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.qpid.jms.provider.amqp; + +import org.apache.qpid.proton.amqp.Binary; +import org.apache.qpid.proton.engine.impl.ProtocolTracer; +import org.apache.qpid.proton.framing.TransportFrame; +import org.slf4j.Logger; + +/** + * Proton-J ProtocolTracer implementation that writes AMQP frame data to the + * given logger target. + */ +public class AmqpProtocolTracer implements ProtocolTracer { + +public static final int DEFAULT_PAYLOAD_STRING_LIMIT = 1024; + +private final Logger logger; +private final int payloadStringLimit; + +public AmqpProtocolTracer(Logger logger) { +this(logger, DEFAULT_PAYLOAD_STRING_LIMIT); +} + +public AmqpProtocolTracer(Logger logger, int payloadStringLimit) { +this.logger = logger; +this.payloadStringLimit = payloadStringLimit; +} + +@Override +public void receivedFrame(TransportFrame transportFrame) { +logger.trace("RECV: {} {}", transportFrame.getBody(), formatPayload(transportFrame)); +} + +@Override +public void sentFrame(TransportFrame transportFrame) { +logger.trace("SENT: {} {}", transportFrame.getBody(), formatPayload(transportFrame)); +} + +private String formatPayload(TransportFrame frame) { +Binary payload = frame.getPayload(); + +if (payload == null || payload.getLength() == 0 || payloadStringLimit <= 0) { +return ""; +} + +final byte[] binData = payload.getArray(); +final int binLength = payload.getLength(); +final int offset = payload.getArrayOffset(); + +StringBuilder builder = new StringBuilder(); + +// Prefix the payload with total bytes which gives insight regardless of truncation. +builder.append(" (").append(payload.getLength()).append(") ").append("\""); + +int size = 0; +boolean truncated = false; +for (int i = 0; i < binLength; i++) { +byte c = binData[offset + i]; + +if (c > 31 && c < 127 && c != '\\') { +if (size + 1 <= payloadStringLimit) { +size += 1; +builder.append((char) c); +} else { +truncated = true; +break; +} +} else { +if (size + 4 <= payloadStringLimit) { +size += 4; +builder.append(String.format("\\x%02x", c)); +} else { +
qpid-proton-j git commit: PROTON-1925 Add enum values for know Section and DeliveryState
Repository: qpid-proton-j Updated Branches: refs/heads/master b2d5d418a -> 3be632d43 PROTON-1925 Add enum values for know Section and DeliveryState Allows for simpler identification and processing using switch or other logic instead of instanceof checks for all types. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/3be632d4 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/3be632d4 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/3be632d4 Branch: refs/heads/master Commit: 3be632d436c52373a53e8ae0c27aac1643960021 Parents: b2d5d41 Author: Timothy Bish Authored: Thu Aug 30 14:19:35 2018 -0400 Committer: Timothy Bish Committed: Thu Aug 30 14:19:35 2018 -0400 -- .../org/apache/qpid/proton/amqp/messaging/Section.java | 12 .../qpid/proton/amqp/transport/DeliveryState.java | 11 ++- 2 files changed, 22 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/3be632d4/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java index 2bcc4d5..8af3595 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.java @@ -22,4 +22,16 @@ package org.apache.qpid.proton.amqp.messaging; public interface Section { +enum SectionType +{ +AmqpSequence, +AmqpValue, +ApplicationProperties, +Data, +DeliveryAnnotations, +Footer, +Header, +MessageAnnotations, +Properties +} } http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/3be632d4/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java index 4fa9806..4f3be66 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.java @@ -29,5 +29,14 @@ package org.apache.qpid.proton.amqp.transport; */ public interface DeliveryState { - +enum DeliveryStateType +{ +Accepted, +Declared, +Modified, +Received, +Rejected, +Released, +Transactional +} } - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton-j git commit: PROTON-1925 Add type values for know Section and DeliveryState
Repository: qpid-proton-j Updated Branches: refs/heads/master 3be632d43 -> e6e78ac84 PROTON-1925 Add type values for know Section and DeliveryState Update the APIs of the DeliveryState and Section implementations to return a type identifier Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/e6e78ac8 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/e6e78ac8 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/e6e78ac8 Branch: refs/heads/master Commit: e6e78ac8496ef686eaf68fa1dea8edbe43353be1 Parents: 3be632d Author: Timothy Bish Authored: Fri Aug 31 09:44:42 2018 -0400 Committer: Timothy Bish Committed: Fri Aug 31 09:44:42 2018 -0400 -- .../qpid/proton/amqp/messaging/Accepted.java | 9 ++--- .../qpid/proton/amqp/messaging/AmqpSequence.java | 10 ++ .../qpid/proton/amqp/messaging/AmqpValue.java | 9 ++--- .../amqp/messaging/ApplicationProperties.java | 9 ++--- .../apache/qpid/proton/amqp/messaging/Data.java| 9 ++--- .../proton/amqp/messaging/DeliveryAnnotations.java | 6 +- .../apache/qpid/proton/amqp/messaging/Footer.java | 10 ++ .../apache/qpid/proton/amqp/messaging/Header.java | 10 ++ .../proton/amqp/messaging/MessageAnnotations.java | 11 +++ .../qpid/proton/amqp/messaging/Modified.java | 11 +++ .../qpid/proton/amqp/messaging/Properties.java | 10 ++ .../qpid/proton/amqp/messaging/Received.java | 13 ++--- .../qpid/proton/amqp/messaging/Rejected.java | 17 + .../qpid/proton/amqp/messaging/Released.java | 10 ++ .../apache/qpid/proton/amqp/messaging/Section.java | 13 + .../qpid/proton/amqp/transaction/Declared.java | 9 ++--- .../amqp/transaction/TransactionalState.java | 12 +++- .../qpid/proton/amqp/transport/DeliveryState.java | 9 +++-- 18 files changed, 117 insertions(+), 70 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/e6e78ac8/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java index d21caaa..ecf11b8 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.java @@ -27,14 +27,12 @@ import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.transport.DeliveryState; -public final class Accepted - implements DeliveryState, Outcome +public final class Accepted implements DeliveryState, Outcome { public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:accepted:list"); private static final Accepted INSTANCE = new Accepted(); - /** * TODO should this (and other DeliveryStates) have a private constructor?? */ @@ -52,4 +50,9 @@ public final class Accepted { return INSTANCE; } + +@Override +public DeliveryStateType getType() { +return DeliveryStateType.Accepted; +} } http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/e6e78ac8/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java index 2a07613..53b11c6 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.java @@ -25,8 +25,7 @@ package org.apache.qpid.proton.amqp.messaging; import java.util.List; -public final class AmqpSequence - implements Section +public final class AmqpSequence implements Section { private final List _value; @@ -40,7 +39,6 @@ public final class AmqpSequence return _value; } - @Override public String toString() { @@ -48,5 +46,9 @@ public final class AmqpSequence _value + '}'; } + +@Override +public SectionType getType() { +return SectionType.AmqpSequence; +} } - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/e6e78ac8/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpValue.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpValue
qpid-jms git commit: QPIDJMS-413 Fix improper calculation in the ReadableBuffer
Repository: qpid-jms Updated Branches: refs/heads/master 740a3973c -> 1d7230e03 QPIDJMS-413 Fix improper calculation in the ReadableBuffer Don't add reader index to the array offset for the underlying buffer. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/1d7230e0 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/1d7230e0 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/1d7230e0 Branch: refs/heads/master Commit: 1d7230e032abf355d9e92778f07eae2609541041 Parents: 740a397 Author: Timothy Bish Authored: Mon Sep 24 15:44:33 2018 -0400 Committer: Timothy Bish Committed: Mon Sep 24 15:49:12 2018 -0400 -- .../provider/amqp/message/AmqpReadableBuffer.java| 2 +- .../amqp/message/AmqpReadableBufferTest.java | 15 +++ 2 files changed, 16 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1d7230e0/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBuffer.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBuffer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBuffer.java index 7f14bf4..6ae43bb 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBuffer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBuffer.java @@ -58,7 +58,7 @@ public class AmqpReadableBuffer implements ReadableBuffer { @Override public int arrayOffset() { -return buffer.arrayOffset() + buffer.readerIndex(); +return buffer.arrayOffset(); } @Override http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1d7230e0/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBufferTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBufferTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBufferTest.java index 59bd371..fc5c99f 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBufferTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpReadableBufferTest.java @@ -60,6 +60,21 @@ public class AmqpReadableBufferTest { } @Test +public void testArrayOffset() { +byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +ByteBuf byteBuffer = Unpooled.wrappedBuffer(data, 5, 5); +AmqpReadableBuffer buffer = new AmqpReadableBuffer(byteBuffer); + +assertTrue(buffer.hasArray()); +assertSame(buffer.array(), byteBuffer.array()); +assertEquals(buffer.arrayOffset(), byteBuffer.arrayOffset()); + +assertEquals(5, buffer.get()); + +assertEquals(buffer.arrayOffset(), byteBuffer.arrayOffset()); +} + +@Test public void testArrayAccessWhenNoArray() { ByteBuf byteBuffer = Unpooled.directBuffer(); AmqpReadableBuffer buffer = new AmqpReadableBuffer(byteBuffer); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton-j git commit: NO-JIRA Add a JMH test for the FrameWriter class for testing
Repository: qpid-proton-j Updated Branches: refs/heads/master e6e78ac84 -> 232cd0077 NO-JIRA Add a JMH test for the FrameWriter class for testing Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/232cd007 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/232cd007 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/232cd007 Branch: refs/heads/master Commit: 232cd0077c462f578c916e7ffde24481fed25b59 Parents: e6e78ac Author: Timothy Bish Authored: Wed Sep 26 11:27:03 2018 -0400 Committer: Timothy Bish Committed: Wed Sep 26 11:27:03 2018 -0400 -- .../engine/impl/FrameWriterBenchmark.java | 132 +++ 1 file changed, 132 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/232cd007/tests/performance-jmh/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriterBenchmark.java -- diff --git a/tests/performance-jmh/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriterBenchmark.java b/tests/performance-jmh/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriterBenchmark.java new file mode 100644 index 000..e91f945 --- /dev/null +++ b/tests/performance-jmh/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriterBenchmark.java @@ -0,0 +1,132 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.qpid.proton.engine.impl; + +import java.nio.ByteBuffer; +import java.util.concurrent.TimeUnit; + +import org.apache.qpid.proton.Proton; +import org.apache.qpid.proton.amqp.Binary; +import org.apache.qpid.proton.amqp.UnsignedInteger; +import org.apache.qpid.proton.amqp.transport.Transfer; +import org.apache.qpid.proton.codec.AMQPDefinedTypes; +import org.apache.qpid.proton.codec.DecoderImpl; +import org.apache.qpid.proton.codec.EncoderImpl; +import org.apache.qpid.proton.codec.ReadableBuffer; +import org.apache.qpid.proton.engine.impl.FrameWriter; +import org.apache.qpid.proton.engine.impl.TransportImpl; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; +import org.openjdk.jmh.profile.GCProfiler; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +/** + * Test performance of the FrameWriter class + */ +@State(Scope.Benchmark) +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) +public class FrameWriterBenchmark { + +private static final byte[] PAYLOAD_BYTES = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +}; + +public static final int DEFAULT_BUFFER_SIZE = 8192; + +private TransportImpl transport; +private FrameWriter frameWriter; +private ByteBuffer byteBuf; +private DecoderImpl decoder; +private EncoderImpl encoder; + +private Transfer transfer; +private ReadableBuffer payload; + +@Setup +public void init(Blackhole blackhole) +{ +initProton(); +} + +public void initProton() { +byteBuf = ByteBuffer.allocate(DEFAU
qpid-proton-j git commit: PROTON-1941 Add ensureRemaining to the WritableBuffer interface
Repository: qpid-proton-j Updated Branches: refs/heads/master 232cd0077 -> 34fcb2d43 PROTON-1941 Add ensureRemaining to the WritableBuffer interface Provide an access point for the codec to request that the WritableBuffer be sized to accept a given number of bytes usually in relation to larger incoming write of a complex type. Add default implementation to preseve backwards compatability and an implementation in the ByteBuffer wrapper that throws early if nont enough bytes exist to handle the announced pending writes. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/34fcb2d4 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/34fcb2d4 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/34fcb2d4 Branch: refs/heads/master Commit: 34fcb2d436787798d4a7eca812b77bf3c2fe700d Parents: 232cd00 Author: Timothy Bish Authored: Wed Sep 26 15:30:31 2018 -0400 Committer: Timothy Bish Committed: Wed Sep 26 15:30:36 2018 -0400 -- .../org/apache/qpid/proton/codec/ArrayType.java | 176 +++- .../apache/qpid/proton/codec/BinaryType.java| 24 +- .../org/apache/qpid/proton/codec/ListType.java | 21 ++ .../org/apache/qpid/proton/codec/MapType.java | 4 + .../apache/qpid/proton/codec/StringType.java| 17 ++ .../apache/qpid/proton/codec/SymbolType.java| 24 +- .../qpid/proton/codec/WritableBuffer.java | 17 ++ .../qpid/proton/engine/impl/FrameWriter.java| 8 +- .../codec/ApplicationPropertiesTypeTest.java| 23 ++ .../qpid/proton/codec/ArrayTypeCodecTest.java | 27 ++ .../qpid/proton/codec/BinaryTypeCodecTest.java | 60 .../qpid/proton/codec/ListTypeCodecTest.java| 27 ++ .../qpid/proton/codec/MapTypeCodecTest.java | 28 ++ .../qpid/proton/codec/StringTypeTest.java | 32 +++ .../qpid/proton/codec/SymbolTypeTest.java | 63 + .../qpid/proton/codec/WritableBufferTest.java | 272 +++ 16 files changed, 748 insertions(+), 75 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/34fcb2d4/proton-j/src/main/java/org/apache/qpid/proton/codec/ArrayType.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/ArrayType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/ArrayType.java index f4f0c8a..06ece52 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/ArrayType.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/ArrayType.java @@ -84,11 +84,13 @@ public class ArrayType implements PrimitiveType decoder.register(this); } +@Override public Class getTypeClass() { return Object[].class; } +@Override public ArrayEncoding getEncoding(final Object[] val) { TypeEncoding encoder = calculateEncoder(val,_encoder); @@ -102,7 +104,6 @@ public class ArrayType implements PrimitiveType private static TypeEncoding calculateEncoder(final Object[] val, final EncoderImpl encoder) { - if(val.length == 0) { AMQPType underlyingType = encoder.getTypeFromClass(val.getClass().getComponentType()); @@ -269,7 +270,6 @@ public class ArrayType implements PrimitiveType size += componentEncoding.getConstructorSize() + componentEncoding.getValueSize(null) * componentCount; - } else { @@ -281,16 +281,19 @@ public class ArrayType implements PrimitiveType return size; } +@Override public ArrayEncoding getCanonicalEncoding() { return _arrayEncoding; } +@Override public Collection getAllEncodings() { return Arrays.asList(_shortArrayEncoding, _arrayEncoding); } +@Override public void write(final Object[] val) { ArrayEncoding encoding = getEncoding(val); @@ -444,25 +447,38 @@ public class ArrayType implements PrimitiveType super(encoder, decoder); } +@Override +protected void writeSize(final Object[] val) +{ +int encodedValueSize = getEncodedValueSize(val); +getEncoder().getBuffer().ensureRemaining(encodedValueSize); +getEncoder().writeRaw(encodedValueSize); +} + +@Override public void writeValue(final boolean[] a) { BooleanType.BooleanEncoding underlyingEncoder = getUnderlyingEncoding(a); -getEncoder().writeRaw(4 + underlyingEncoder.getConstructorSize() - + a.length*underlyingEncoder.getValueSize(null)); +int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + +
qpid-jms git commit: NO-JIRA Fix intermittent test failures due to timing
Repository: qpid-jms Updated Branches: refs/heads/master 51cbfa258 -> 881e8f62d NO-JIRA Fix intermittent test failures due to timing On very fast machine the delay can be the exact value specified so a check on greatThanOrEqualTo is needed to ensure no sporadic faulures Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/881e8f62 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/881e8f62 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/881e8f62 Branch: refs/heads/master Commit: 881e8f62d582745b2dfe829b94076652c67b5955 Parents: 51cbfa2 Author: Timothy Bish Authored: Fri Sep 28 14:53:09 2018 -0400 Committer: Timothy Bish Committed: Fri Sep 28 14:53:19 2018 -0400 -- .../qpid/jms/provider/failover/FailoverIntegrationTest.java| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/881e8f62/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index f6b1818..2a4034a 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -1975,7 +1975,7 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { producer.send(message2); long elapsed = System.currentTimeMillis() - start; -MatcherAssert.assertThat("Send call should have taken at least the disposition delay", elapsed, Matchers.greaterThan(delay)); +MatcherAssert.assertThat("Send call should have taken at least the disposition delay", elapsed, Matchers.greaterThanOrEqualTo(delay)); connection.close(); @@ -2059,9 +2059,9 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { } catch (JMSException jmse) { //Expected long elapsed = System.currentTimeMillis() - start; -MatcherAssert.assertThat("Send call should have taken at least the disposition delay", elapsed, Matchers.greaterThan(delay)); +MatcherAssert.assertThat("Send call should have taken at least the disposition delay", elapsed, Matchers.greaterThanOrEqualTo(delay)); -if(inspectException) { +if (inspectException) { assertTrue(jmse instanceof ResourceAllocationException); assertTrue(jmse.getMessage().contains("RLE description")); } - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton-j git commit: PROTON-1948 Refactor FrameWriter with more performant buffer
Repository: qpid-proton-j Updated Branches: refs/heads/master 34fcb2d43 -> 1a5e19369 PROTON-1948 Refactor FrameWriter with more performant buffer Refactor the FrameWriter to use a more performant ReadableBuffer wrapper around a byte array that auto grows as an ecode requires instead of reallocating a ByteBuffer and copying past contents and then performing a new encode any time space is exhausted. Removing the layer of buffer abstractions leads to an increase in overall performance under normal operations as well. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/1a5e1936 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/1a5e1936 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/1a5e1936 Branch: refs/heads/master Commit: 1a5e1936944c11bae64244a3223e3be98b2d6d18 Parents: 34fcb2d Author: Timothy Bish Authored: Wed Oct 3 11:53:29 2018 -0400 Committer: Timothy Bish Committed: Wed Oct 3 11:53:29 2018 -0400 -- .../qpid/proton/engine/impl/FrameWriter.java| 263 +++ .../proton/engine/impl/FrameWriterBuffer.java | 232 ++ .../qpid/proton/engine/impl/SaslImpl.java | 4 +- .../qpid/proton/engine/impl/TransportImpl.java | 6 +- .../engine/impl/FrameWriterBufferTest.java | 723 +++ .../proton/engine/impl/FrameWriterTest.java | 357 + .../qpid/proton/systemtests/DeliveryTest.java | 145 +++- .../qpid/proton/systemtests/EngineTestBase.java | 25 + .../engine/impl/FrameWriterBenchmark.java | 4 +- 9 files changed, 1580 insertions(+), 179 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/1a5e1936/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter.java index 13d481c..b76dc5c 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameWriter.java @@ -20,7 +20,6 @@ */ package org.apache.qpid.proton.engine.impl; -import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.Binary; @@ -28,225 +27,153 @@ import org.apache.qpid.proton.amqp.transport.EmptyFrame; import org.apache.qpid.proton.amqp.transport.FrameBody; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.ReadableBuffer; -import org.apache.qpid.proton.codec.WritableBuffer; import org.apache.qpid.proton.framing.TransportFrame; /** - * FrameWriter - * + * Writes Frames to an internal buffer for later processing by the transport. */ -class FrameWriter -{ +class FrameWriter { + +static final int DEFAULT_FRAME_BUFFER_FULL_MARK = 64 * 1024; +static final int FRAME_HEADER_SIZE = 8; static final byte AMQP_FRAME_TYPE = 0; -static final byte SASL_FRAME_TYPE = (byte) 1; - -private EncoderImpl _encoder; -private ByteBuffer _bbuf; -private WritableBuffer _buffer; -private int _maxFrameSize; -private byte _frameType; -final private Ref _protocolTracer; -private TransportImpl _transport; - -private int _frameStart = 0; -private int _payloadStart; -private int _performativeSize; -private long _framesOutput = 0; - -FrameWriter(EncoderImpl encoder, int maxFrameSize, byte frameType, -Ref protocolTracer, TransportImpl transport) -{ -_encoder = encoder; -_bbuf = ByteBuffer.allocate(1024); -_buffer = new WritableBuffer.ByteBufferWrapper(_bbuf); -_encoder.setByteBuffer(_buffer); -_maxFrameSize = maxFrameSize; -_frameType = frameType; -_protocolTracer = protocolTracer; -_transport = transport; -} +static final byte SASL_FRAME_TYPE = 1; + +private final TransportImpl transport; +private final EncoderImpl encoder; +private final FrameWriterBuffer frameBuffer = new FrameWriterBuffer(); + +// Configuration of this Frame Writer +private int maxFrameSize; +private final byte frameType; +private int frameBufferMaxBytes = DEFAULT_FRAME_BUFFER_FULL_MARK; + +// State of current write operation, reset on start of each new write +private int frameStart; -void setMaxFrameSize(int maxFrameSize) -{ -_maxFrameSize = maxFrameSize; +// Frame Writer metrics +private long framesOutput; + +FrameWriter(EncoderImpl encoder, int maxFrameSize, byte frameType, TransportImpl transport) { +this.encoder = encoder; +this.maxFrameSize = maxFrameSize; +this.frameType = frameType; +
[2/2] qpid-jms git commit: QPIDJMS-416 Run all AmqpProvider work on netty event loop thread
QPIDJMS-416 Run all AmqpProvider work on netty event loop thread Move from a separate provider executor to using the netty event loop for AMQP protocol handling. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/4314482d Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/4314482d Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/4314482d Branch: refs/heads/master Commit: 4314482de1e8cb7e58d8331ca0e459f32d78ab4e Parents: 4b8739b Author: Timothy Bish Authored: Tue Oct 9 16:25:23 2018 -0400 Committer: Timothy Bish Committed: Tue Oct 9 16:25:23 2018 -0400 -- .../qpid/jms/provider/amqp/AmqpProvider.java| 969 +-- .../apache/qpid/jms/transports/Transport.java | 26 +- .../jms/transports/netty/NettyTcpTransport.java | 85 +- .../jms/provider/amqp/AmqpProviderTest.java | 104 +- .../netty/NettyOpenSslTransportTest.java| 4 +- .../transports/netty/NettySslTransportTest.java | 12 +- .../transports/netty/NettyTcpTransportTest.java | 128 ++- .../transports/netty/NettyWsTransportTest.java | 14 +- 8 files changed, 788 insertions(+), 554 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4314482d/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java index cc3915d..dbdc977 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java @@ -19,6 +19,7 @@ package org.apache.qpid.jms.provider.amqp; import java.io.IOException; import java.net.URI; import java.nio.ByteBuffer; +import java.security.ProviderException; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -26,9 +27,10 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Future; +import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -72,7 +74,6 @@ import org.apache.qpid.jms.transports.TransportListener; import org.apache.qpid.jms.util.IOExceptionSupport; import org.apache.qpid.jms.util.PropertyUtil; import org.apache.qpid.jms.util.QpidJMSThreadFactory; -import org.apache.qpid.jms.util.ThreadPoolUtils; import org.apache.qpid.proton.engine.Collector; import org.apache.qpid.proton.engine.Connection; import org.apache.qpid.proton.engine.Delivery; @@ -140,7 +141,7 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP private final URI remoteURI; private final AtomicBoolean closed = new AtomicBoolean(); private volatile Throwable failureCause; -private ScheduledThreadPoolExecutor serializer; +private ScheduledExecutorService serializer; private final org.apache.qpid.proton.engine.Transport protonTransport = org.apache.qpid.proton.engine.Transport.Factory.create(); private final Collector protonCollector = new CollectorImpl(); @@ -164,127 +165,130 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP this.remoteURI = remoteURI; this.transport = transport; this.futureFactory = futureFactory; - -serializer = new ScheduledThreadPoolExecutor(1, new QpidJMSThreadFactory( -"AmqpProvider :(" + PROVIDER_SEQUENCE.incrementAndGet() + "):[" + -remoteURI.getScheme() + "://" + remoteURI.getHost() + ":" + remoteURI.getPort() + "]", true)); - -serializer.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); -serializer.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); } @Override public void connect(final JmsConnectionInfo connectionInfo) throws IOException { checkClosedOrFailed(); +if (serializer != null) { +throw new IllegalStateException("Connect cannot be called more than once"); +} + final ProviderFuture connectRequest = futureFactory.createFuture(); -serializer.execute(new Runnable() { +// Configure Transport prior to initialization at which point configuration is set and +// cannot be updated. All further interaction should take place on the serializer for +// thre
[1/2] qpid-jms git commit: QPIDJMS-416 Run all AmqpProvider work on netty event loop thread
Repository: qpid-jms Updated Branches: refs/heads/master 4b8739b75 -> 4314482de http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4314482d/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java index f463971..469be6e 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.junit.Assume.assumeTrue; @@ -29,6 +30,7 @@ import java.lang.reflect.Field; import java.net.URI; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.apache.qpid.jms.test.QpidJmsTestCase; @@ -36,8 +38,12 @@ import org.apache.qpid.jms.test.Wait; import org.apache.qpid.jms.transports.Transport; import org.apache.qpid.jms.transports.TransportListener; import org.apache.qpid.jms.transports.TransportOptions; +import org.apache.qpid.jms.util.QpidJMSTestRunner; +import org.apache.qpid.jms.util.QpidJMSThreadFactory; +import org.apache.qpid.jms.util.Repeat; import org.junit.Ignore; import org.junit.Test; +import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,6 +59,7 @@ import io.netty.util.ResourceLeakDetector.Level; /** * Test basic functionality of the Netty based TCP transport. */ +@RunWith(QpidJMSTestRunner.class) public class NettyTcpTransportTest extends QpidJmsTestCase { private static final Logger LOG = LoggerFactory.getLogger(NettyTcpTransportTest.class); @@ -91,6 +98,42 @@ public class NettyTcpTransportTest extends QpidJmsTestCase { } } +@Test(timeout = 6) +public void testConnectWithCustomThreadFactoryConfigured() throws Exception { +try (NettyEchoServer server = createEchoServer(createServerOptions())) { +server.start(); + +int port = server.getServerPort(); +URI serverLocation = new URI("tcp://localhost:" + port); +QpidJMSThreadFactory factory = new QpidJMSThreadFactory("NettyTransportTest", true); + +Transport transport = createTransport(serverLocation, testListener, createClientOptions()); +transport.setThreadFactory(factory); + +try { +transport.connect(null, null); +} catch (Exception e) { +LOG.info("Failed to connect to: {} as expected.", serverLocation); +fail("Should have failed to connect to the server: " + serverLocation); +} + +assertTrue(transport.isConnected()); +assertSame(factory, transport.getThreadFactory()); + +try { +transport.setThreadFactory(factory); +} catch (IllegalStateException expected) { +LOG.trace("Caught expected state exception"); +} + +transport.close(); +} + +assertTrue(!transportClosed); // Normal shutdown does not trigger the event. +assertTrue(exceptions.isEmpty()); +assertTrue(data.isEmpty()); +} + @Test(timeout = 60 * 1000) public void testConnectWithoutRunningServer() throws Exception { try (NettyEchoServer server = createEchoServer(createServerOptions())) { @@ -103,7 +146,7 @@ public class NettyTcpTransportTest extends QpidJmsTestCase { Transport transport = createTransport(serverLocation, testListener, createClientOptions()); try { -transport.connect(null); +transport.connect(null, null); fail("Should have failed to connect to the server: " + serverLocation); } catch (Exception e) { LOG.info("Failed to connect to: {} as expected.", serverLocation); @@ -129,7 +172,7 @@ public class NettyTcpTransportTest extends QpidJmsTestCase { Transport transport = createTransport(serverLocation, null, createClientOptions()); try { -transport.connect(null); +transport.connect(null, null); fail("Should have failed to connect to the server: " + serverLocation); } catch (Exception e) { LOG.info("Failed to connect to: {} as expected.", serverLocation); @@ -155,7 +
qpid-jms git commit: QPIDJMS-416 Allow the event loop to run until Transport close
Repository: qpid-jms Updated Branches: refs/heads/master 4314482de -> bbc00f58a QPIDJMS-416 Allow the event loop to run until Transport close Allow the event loop to close only on Transport close to ensure that work can be done async by users of the Transport up to the close. Also fixes some random test failures by ensuring that the init method failure triggers channel abort before connection completes. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/bbc00f58 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/bbc00f58 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/bbc00f58 Branch: refs/heads/master Commit: bbc00f58a326eab0668bd2bfa91fdc97ca30297e Parents: 4314482 Author: Timothy Bish Authored: Thu Oct 11 19:10:35 2018 -0400 Committer: Timothy Bish Committed: Thu Oct 11 20:38:37 2018 -0400 -- .../qpid/jms/transports/netty/NettyTcpTransport.java | 11 +++ .../qpid/jms/transports/netty/NettyTcpTransportTest.java | 2 +- .../qpid/jms/transports/netty/NettyWsTransportTest.java | 2 ++ 3 files changed, 6 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bbc00f58/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java index e9c66b7..1cf9ead 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java @@ -168,7 +168,9 @@ public class NettyTcpTransport implements Transport { try { initRoutine.run(); } catch (Throwable initError) { -failureCause = IOExceptionSupport.create(initError); +LOG.warn("Error during initialization of channel from provided initialization routine"); +connectionFailed(connectedChannel, IOExceptionSupport.create(initError)); +throw initError; } } configureChannel(connectedChannel); @@ -203,13 +205,6 @@ public class NettyTcpTransport implements Transport { channel.close().syncUninterruptibly(); channel = null; } -if (group != null) { -Future fut = group.shutdownGracefully(0, SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS); -if (!fut.awaitUninterruptibly(2 * SHUTDOWN_TIMEOUT)) { -LOG.trace("Channel group shutdown failed to complete in allotted time"); -} -group = null; -} throw failureCause; } else { http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bbc00f58/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java index 469be6e..87cf074 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java @@ -562,7 +562,7 @@ public class NettyTcpTransportTest extends QpidJmsTestCase { transport.close(); } -assertTrue(transportClosed); // Normal shutdown does not trigger the event. +assertFalse(transportClosed); // Normal shutdown does not trigger the event. assertTrue(exceptions.isEmpty()); assertTrue(data.isEmpty()); } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bbc00f58/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java index 2ea873d..4e3164c 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java @@ -317,6 +317,8 @@ public class NettyWsTransportTest extends NettyTcpTransportTest {
[2/2] qpid-jms git commit: QPIDJMS-418 Optimize usage of Symbol types to reduce overhead
QPIDJMS-418 Optimize usage of Symbol types to reduce overhead The code is currently doing many Symbol.valueOf calls for each message on send and receive where it should be using cached Symbol values to avoid the overhead of the Symbol objects cache lookups and string compares. Clean up some other ares where we process Symbols to reduce overhead on send and receive. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/cbde557d Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/cbde557d Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/cbde557d Branch: refs/heads/master Commit: cbde557d22e1d1e861bf83505899a7f9a0c51067 Parents: 21f791a Author: Timothy Bish Authored: Tue Oct 16 15:12:30 2018 -0400 Committer: Timothy Bish Committed: Tue Oct 16 15:12:30 2018 -0400 -- .../qpid/jms/message/JmsMessageIDBuilder.java | 2 +- .../amqp/builders/AmqpConsumerBuilder.java | 6 +- .../amqp/builders/AmqpProducerBuilder.java | 4 +- .../amqp/message/AmqpDestinationHelper.java | 55 ++--- .../amqp/message/AmqpJmsMessageFacade.java | 49 +++-- .../amqp/message/AmqpMessageIdHelper.java | 33 ++- .../amqp/message/AmqpMessageSupport.java| 34 +-- .../BytesMessageIntegrationTest.java| 26 +-- .../ForeignMessageIntegrationTest.java | 7 +- .../integration/JMSConsumerIntegrationTest.java | 15 +- .../integration/JMSProducerIntegrationTest.java | 3 +- .../integration/MapMessageIntegrationTest.java | 7 +- .../jms/integration/MessageIntegrationTest.java | 59 +++--- ...ultiTransferFrameMessageIntegrationTest.java | 5 +- .../ObjectMessageIntegrationTest.java | 25 ++- .../integration/ProducerIntegrationTest.java| 6 +- .../StreamMessageIntegrationTest.java | 7 +- .../provider/amqp/message/AmqpCodecTest.java| 22 +- .../amqp/message/AmqpDestinationHelperTest.java | 206 +-- .../message/AmqpJmsBytesMessageFacadeTest.java | 5 +- .../message/AmqpJmsMapMessageFacadeTest.java| 4 +- .../amqp/message/AmqpJmsMessageFacadeTest.java | 49 +++-- .../message/AmqpJmsObjectMessageFacadeTest.java | 17 +- .../message/AmqpJmsStreamMessageFacadeTest.java | 4 +- .../message/AmqpJmsTextMessageFacadeTest.java | 5 +- .../amqp/message/AmqpMessageIdHelperTest.java | 46 ++--- .../amqp/message/AmqpMessageSupportTest.java| 33 ++- .../qpid/jms/util/ContentTypeSupportTest.java | 7 +- 28 files changed, 350 insertions(+), 391 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cbde557d/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java index 66d6487..319506b 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java @@ -35,7 +35,7 @@ public interface JmsMessageIDBuilder { @Override public Object createMessageID(String producerId, long messageSequence) { String messageId = producerId + "-" + messageSequence; -if (!AmqpMessageIdHelper.INSTANCE.hasMessageIdPrefix(messageId)) { +if (!AmqpMessageIdHelper.hasMessageIdPrefix(messageId)) { messageId = AmqpMessageIdHelper.JMS_ID_PREFIX + messageId; } return messageId; http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cbde557d/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConsumerBuilder.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConsumerBuilder.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConsumerBuilder.java index dbaf83f..ae45aca 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConsumerBuilder.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConsumerBuilder.java @@ -71,7 +71,7 @@ public class AmqpConsumerBuilder extends AmqpResourceBuilder capabilities = new LinkedList<>(); -Symbol typeCapability = AmqpDestinationHelper.INSTANCE.toTypeCapability(resourceInfo.getDestination()); +Symbol typeCapability = AmqpDestinationHelper.toTypeCapability(resourceInfo.getDestination()); if(typeCapability != null){
[1/2] qpid-jms git commit: QPIDJMS-418 Optimize usage of Symbol types to reduce overhead
Repository: qpid-jms Updated Branches: refs/heads/master 21f791a7d -> cbde557d2 http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cbde557d/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodecTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodecTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodecTest.java index 7ebd50f..9d72d27 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodecTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodecTest.java @@ -249,7 +249,7 @@ public class AmqpCodecTest extends QpidJmsTestCase { Message message = Proton.message(); Map map = new HashMap(); -map.put(Symbol.valueOf(AmqpMessageSupport.JMS_MSG_TYPE), (byte) -1); +map.put(AmqpMessageSupport.JMS_MSG_TYPE, (byte) -1); MessageAnnotations messageAnnotations = new MessageAnnotations(map); message.setMessageAnnotations(messageAnnotations); @@ -269,7 +269,7 @@ public class AmqpCodecTest extends QpidJmsTestCase { Message message = Proton.message(); Map map = new HashMap(); -map.put(Symbol.valueOf(AmqpMessageSupport.JMS_MSG_TYPE), AmqpMessageSupport.JMS_MESSAGE); +map.put(AmqpMessageSupport.JMS_MSG_TYPE, AmqpMessageSupport.JMS_MESSAGE); MessageAnnotations messageAnnotations = new MessageAnnotations(map); message.setMessageAnnotations(messageAnnotations); @@ -295,7 +295,7 @@ public class AmqpCodecTest extends QpidJmsTestCase { Message message = Proton.message(); Map map = new HashMap(); -map.put(Symbol.valueOf(AmqpMessageSupport.JMS_MSG_TYPE), AmqpMessageSupport.JMS_BYTES_MESSAGE); +map.put(AmqpMessageSupport.JMS_MSG_TYPE, AmqpMessageSupport.JMS_BYTES_MESSAGE); MessageAnnotations messageAnnotations = new MessageAnnotations(map); message.setMessageAnnotations(messageAnnotations); @@ -321,7 +321,7 @@ public class AmqpCodecTest extends QpidJmsTestCase { Message message = Proton.message(); Map map = new HashMap(); -map.put(Symbol.valueOf(AmqpMessageSupport.JMS_MSG_TYPE), AmqpMessageSupport.JMS_TEXT_MESSAGE); +map.put(AmqpMessageSupport.JMS_MSG_TYPE, AmqpMessageSupport.JMS_TEXT_MESSAGE); MessageAnnotations messageAnnotations = new MessageAnnotations(map); message.setMessageAnnotations(messageAnnotations); @@ -366,13 +366,13 @@ public class AmqpCodecTest extends QpidJmsTestCase { Message message = Proton.message(); Map map = new HashMap(); -map.put(Symbol.valueOf(AmqpMessageSupport.JMS_MSG_TYPE), AmqpMessageSupport.JMS_OBJECT_MESSAGE); +map.put(AmqpMessageSupport.JMS_MSG_TYPE, AmqpMessageSupport.JMS_OBJECT_MESSAGE); MessageAnnotations messageAnnotations = new MessageAnnotations(map); message.setMessageAnnotations(messageAnnotations); if (setJavaSerializedContentType) { - message.setContentType(AmqpMessageSupport.SERIALIZED_JAVA_OBJECT_CONTENT_TYPE); + message.setContentType(AmqpMessageSupport.SERIALIZED_JAVA_OBJECT_CONTENT_TYPE.toString()); } JmsMessage jmsMessage = AmqpCodec.decodeMessage(mockConsumer, encodeMessage(message)).asJmsMessage(); @@ -404,7 +404,7 @@ public class AmqpCodecTest extends QpidJmsTestCase { Message message = Proton.message(); Map map = new HashMap(); -map.put(Symbol.valueOf(AmqpMessageSupport.JMS_MSG_TYPE), AmqpMessageSupport.JMS_STREAM_MESSAGE); +map.put(AmqpMessageSupport.JMS_MSG_TYPE, AmqpMessageSupport.JMS_STREAM_MESSAGE); MessageAnnotations messageAnnotations = new MessageAnnotations(map); message.setMessageAnnotations(messageAnnotations); @@ -433,7 +433,7 @@ public class AmqpCodecTest extends QpidJmsTestCase { @Test public void testCreateBytesMessageFromNoBodySectionAndContentType() throws Exception { Message message = Proton.message(); -message.setContentType(AmqpMessageSupport.OCTET_STREAM_CONTENT_TYPE); + message.setContentType(AmqpMessageSupport.OCTET_STREAM_CONTENT_TYPE.toString()); JmsMessage jmsMessage = AmqpCodec.decodeMessage(mockConsumer, encodeMessage(message)).asJmsMessage(); assertNotNull("Message should not be null", jmsMessage); @@ -475,7 +475,7 @@ public class AmqpCodecTest extends QpidJmsTestCase { @Test public void testCreateObjectMessageFromNoBodySectionAndContentType() throws Exception { Message message = Proton.message(); - message.setContentType(AmqpMessageSupport.SERIALIZED_JAVA_OBJECT_CONTENT_TYPE); + message.setContentType(AmqpMessageSupport.SERIALIZED_JAVA_OBJECT_CONTENT_TYPE.toString()); JmsMessage jmsMessage
qpid-jms git commit: QPIDJMS-419 Ensure created resources are tracked at all times
Repository: qpid-jms Updated Branches: refs/heads/master cbde557d2 -> 59884aa60 QPIDJMS-419 Ensure created resources are tracked at all times If the request to create a resource doesn't complete until after a failover and reconnect the recovery of the JMS resources on reconnect may miss the fact it needs to recover that resource. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/59884aa6 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/59884aa6 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/59884aa6 Branch: refs/heads/master Commit: 59884aa60c89b843f8d8de1c26734a6d53417719 Parents: cbde557 Author: Timothy Bish Authored: Wed Oct 17 12:50:26 2018 -0400 Committer: Timothy Bish Committed: Wed Oct 17 12:50:26 2018 -0400 -- .../java/org/apache/qpid/jms/JmsConnection.java | 5 ++- .../apache/qpid/jms/JmsConnectionConsumer.java | 19 ++- .../org/apache/qpid/jms/JmsMessageConsumer.java | 21 + .../org/apache/qpid/jms/JmsMessageProducer.java | 19 ++- .../java/org/apache/qpid/jms/JmsSession.java| 33 +++- .../failover/FailoverIntegrationTest.java | 1 + 6 files changed, 67 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/59884aa6/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index bb456fe..cf78fe0 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -311,7 +311,6 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection createJmsConnection(); int ackMode = getSessionAcknowledgeMode(transacted, acknowledgeMode); JmsSession result = new JmsSession(this, getNextSessionId(), ackMode); -addSession(result.getSessionInfo(), result); if (started.get()) { result.start(); } @@ -558,7 +557,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection return result; } -protected void removeSession(JmsSessionInfo sessionInfo) throws JMSException { +protected void removeSession(JmsSessionInfo sessionInfo) { sessions.remove(sessionInfo.getId()); } @@ -566,7 +565,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection sessions.put(sessionInfo.getId(), session); } -protected void removeConnectionConsumer(JmsConsumerInfo consumerInfo) throws JMSException { +protected void removeConnectionConsumer(JmsConsumerInfo consumerInfo) { connectionConsumers.remove(consumerInfo.getId()); } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/59884aa6/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionConsumer.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionConsumer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionConsumer.java index f336676..1476f49 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionConsumer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionConsumer.java @@ -43,6 +43,7 @@ import org.apache.qpid.jms.meta.JmsConsumerInfo; import org.apache.qpid.jms.meta.JmsResource.ResourceState; import org.apache.qpid.jms.policy.JmsRedeliveryPolicy; import org.apache.qpid.jms.provider.ProviderConstants.ACK_TYPE; +import org.apache.qpid.jms.provider.ProviderSynchronization; import org.apache.qpid.jms.util.MessageQueue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,13 +89,17 @@ public class JmsConnectionConsumer implements ConnectionConsumer, JmsMessageDisp dispatcher.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); dispatcher.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); -connection.addConnectionConsumer(consumerInfo, this); -try { -connection.createResource(consumerInfo); -} catch (JMSException jmse) { -connection.removeConnectionConsumer(consumerInfo); -throw jmse; -} +connection.createResource(consumerInfo, new ProviderSynchronization() { + +@Override +public void onPendingSuccess() { +connection.addConnectionConsumer(consumerInfo, JmsConnectionConsumer.this); +} + +@Override +public void onPendingFailure(Throwable cause) { +
qpid-jms git commit: QPIDJMS-420 Avoid signaling attempt costs when no waiters
Repository: qpid-jms Updated Branches: refs/heads/master 59884aa60 -> 72bbc8060 QPIDJMS-420 Avoid signaling attempt costs when no waiters Track if a receive (dequeue) call is waiting on the prefetch queue in the consumer and if none present don't try to wait a thread which avoids some cost and reduces time under lock. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/72bbc806 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/72bbc806 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/72bbc806 Branch: refs/heads/master Commit: 72bbc8060bd724baf844733454d3f90844a50e5f Parents: 59884aa Author: Timothy Bish Authored: Wed Oct 17 14:33:31 2018 -0400 Committer: Timothy Bish Committed: Wed Oct 17 14:33:31 2018 -0400 -- .../qpid/jms/util/AbstractMessageQueue.java | 21 +--- .../apache/qpid/jms/util/FifoMessageQueue.java | 10 +++--- .../qpid/jms/util/PriorityMessageQueue.java | 8 ++-- 3 files changed, 31 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/72bbc806/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java index edf8a48..a3dda4b 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java @@ -28,6 +28,8 @@ public abstract class AbstractMessageQueue implements MessageQueue { private volatile boolean running; private final Object lock = new Object(); +private int waiters; + @Override public final JmsInboundMessageDispatch peek() { synchronized (lock) { @@ -40,6 +42,7 @@ public abstract class AbstractMessageQueue implements MessageQueue { synchronized (lock) { // Wait until the consumer is ready to deliver messages. while (timeout != 0 && !closed && isEmpty() && running) { +waiters++; if (timeout == -1) { lock.wait(); } else { @@ -47,6 +50,7 @@ public abstract class AbstractMessageQueue implements MessageQueue { lock.wait(timeout); timeout = Math.max(timeout + start - System.currentTimeMillis(), 0); } +waiters--; } if (closed || !running || isEmpty()) { @@ -73,7 +77,10 @@ public abstract class AbstractMessageQueue implements MessageQueue { if (!closed) { running = true; } -lock.notifyAll(); + +if (hasWaiters()) { +lock.notifyAll(); +} } } @@ -81,7 +88,9 @@ public abstract class AbstractMessageQueue implements MessageQueue { public final void stop() { synchronized (lock) { running = false; -lock.notifyAll(); +if (hasWaiters()) { +lock.notifyAll(); +} } } @@ -95,7 +104,9 @@ public abstract class AbstractMessageQueue implements MessageQueue { synchronized (lock) { running = false; closed = true; -lock.notifyAll(); +if (hasWaiters()) { +lock.notifyAll(); +} } } @@ -109,6 +120,10 @@ public abstract class AbstractMessageQueue implements MessageQueue { return lock; } +protected boolean hasWaiters() { +return waiters > 0; +} + /** * Removes and returns the first entry in the implementation queue. This method * is always called under lock and does not need to protect itself or check running http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/72bbc806/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/FifoMessageQueue.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/FifoMessageQueue.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/FifoMessageQueue.java index a6860d1..40f3961 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/FifoMessageQueue.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/FifoMessageQueue.java @@ -31,14 +31,16 @@ public final class FifoMessageQueue extends AbstractMessageQueue { protected final Deque queue; public FifoMessageQueue(int prefetchSize) { -this.queue = new ArrayDeque(prefetchSize); +this.queue = new ArrayDeque(Ma
qpid-jms git commit: QPIDJMS-421 Cache common message annotation encodings for sends
Repository: qpid-jms Updated Branches: refs/heads/master add459362 -> 0089ed185 QPIDJMS-421 Cache common message annotation encodings for sends Use a cache to store the msot commonly used message annotations that are applied to outbound messages in order to reduce overhead of sends that would otherwise be encoding the same annotations map each time. Only when additional JMS features like scheduled delivery time are used will we need to perform a full encode on the MessageAnnotations section of the outbound message. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/0089ed18 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/0089ed18 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/0089ed18 Branch: refs/heads/master Commit: 0089ed185c8e98c3a05e5724becf8091076134b8 Parents: add4593 Author: Timothy Bish Authored: Fri Oct 19 13:48:03 2018 -0400 Committer: Timothy Bish Committed: Fri Oct 19 13:49:41 2018 -0400 -- .../jms/provider/amqp/message/AmqpCodec.java| 95 - .../amqp/message/AmqpDestinationHelper.java | 55 +++ .../amqp/message/AmqpJmsMessageFacade.java | 18 ++- .../provider/amqp/message/AmqpCodecTest.java| 142 ++- .../amqp/message/AmqpDestinationHelperTest.java | 34 +++-- .../message/AmqpJmsBytesMessageFacadeTest.java | 12 +- .../message/AmqpJmsMapMessageFacadeTest.java| 11 +- .../amqp/message/AmqpJmsMessageFacadeTest.java | 9 +- .../message/AmqpJmsObjectMessageFacadeTest.java | 11 +- .../message/AmqpJmsStreamMessageFacadeTest.java | 14 +- .../message/AmqpJmsTextMessageFacadeTest.java | 14 +- 11 files changed, 313 insertions(+), 102 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/0089ed18/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodec.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodec.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodec.java index 733294f..fc68747 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodec.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpCodec.java @@ -28,8 +28,13 @@ import static org.apache.qpid.jms.provider.amqp.message.AmqpMessageSupport.SERIA import static org.apache.qpid.jms.provider.amqp.message.AmqpMessageSupport.isContentType; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import org.apache.qpid.jms.provider.amqp.AmqpConsumer; import org.apache.qpid.jms.util.ContentTypeSupport; @@ -59,22 +64,33 @@ import io.netty.buffer.ByteBuf; */ public final class AmqpCodec { -private static class EncoderDecoderPair { +private static class EncoderDecoderContext { DecoderImpl decoder = new DecoderImpl(); EncoderImpl encoder = new EncoderImpl(decoder); { AMQPDefinedTypes.registerAllTypes(decoder, encoder); } + +// Store local duplicates from the global cache for thread safety. +Map messageAnnotationsCache = new HashMap<>(); } -private static final ThreadLocal TLS_CODEC = new ThreadLocal() { +private static final ThreadLocal TLS_CODEC = new ThreadLocal() { @Override -protected EncoderDecoderPair initialValue() { -return new EncoderDecoderPair(); +protected EncoderDecoderContext initialValue() { +return new EncoderDecoderContext(); } }; /** + * Static cache for all cached MessageAnnotation data which is used to populate the + * duplicate values stored in the TLS Encoder Decoder contexts. This Map instance must + * be thread safe as many different producers on different threads can be passing data + * through this codec and accessing the cache if a TLS duplicate isn't populated yet. + */ +private static ConcurrentMap GLOBAL_ANNOTATIONS_CACHE = new ConcurrentHashMap<>(); + +/** * @return a Encoder instance. */ public static EncoderImpl getEncoder() { @@ -143,9 +159,11 @@ public final class AmqpCodec { * @return a buffer containing the wire level representation of the input Message. */ public static ByteBuf encodeMessage(AmqpJmsMessageFacade message) { +EncoderDecoderContext context = TLS_CODEC.get(); + AmqpWritableBuffer buffer = new AmqpWritableBuffer(); -EncoderImpl encoder = getEncoder(); +
[1/2] qpid-jms git commit: QPIDJMS-420 Allow for direct dispatch to target JMS MessageConsumer
Repository: qpid-jms Updated Branches: refs/heads/master 50118e010 -> d96734e0f QPIDJMS-420 Allow for direct dispatch to target JMS MessageConsumer Allow the connection to be provided a direct path to the targeted consumer of an inbound message as opposed to looking one up via the session map and then the session's consumer map. Preserves the legacy lookups for compatibility with connection consumer paths. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/56b24dc4 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/56b24dc4 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/56b24dc4 Branch: refs/heads/master Commit: 56b24dc43a58bdfdfdd7ed18d34d51db5c3b66e7 Parents: 50118e0 Author: Timothy Bish Authored: Fri Oct 26 15:55:08 2018 -0400 Committer: Timothy Bish Committed: Fri Oct 26 15:55:35 2018 -0400 -- .../java/org/apache/qpid/jms/JmsConnection.java | 31 - .../org/apache/qpid/jms/JmsMessageConsumer.java | 2 +- .../apache/qpid/jms/meta/JmsConsumerInfo.java | 12 +-- .../qpid/jms/provider/amqp/AmqpConsumer.java| 35 +--- .../qpid/jms/meta/JmsConsumerInfoTest.java | 33 +- .../jms/meta/JmsDefaultResourceVisitorTest.java | 2 +- .../amqp/AmqpSubscriptionTrackerTest.java | 2 +- .../provider/amqp/message/AmqpCodecTest.java| 2 +- .../message/AmqpJmsMessageTypesTestCase.java| 2 +- .../failover/FailoverProviderTestSupport.java | 2 +- 10 files changed, 64 insertions(+), 59 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/56b24dc4/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index cf78fe0..a3537e3 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -469,7 +469,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection messageQueue = new FifoMessageQueue(configuredPrefetch); } -JmsConsumerInfo consumerInfo = new JmsConsumerInfo(getNextConnectionConsumerId(), messageQueue); +JmsConsumerInfo consumerInfo = new JmsConsumerInfo(getNextConnectionConsumerId(), messageQueue, null); consumerInfo.setExplicitClientID(isExplicitClientID()); consumerInfo.setSelector(messageSelector); consumerInfo.setDurable(durable); @@ -1177,36 +1177,37 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection @Override public void onInboundMessage(final JmsInboundMessageDispatch envelope) { - JmsMessage incoming = envelope.getMessage(); if (incoming != null) { -// Ensure incoming Messages are in readonly mode. +// Ensure incoming Messages are in read-only mode and configured properly incoming.setReadOnlyBody(true); incoming.setReadOnlyProperties(true); - incoming.setValidatePropertyNames(isValidatePropertyNames()); } -JmsMessageDispatcher dispatcher = sessions.get(envelope.getConsumerId().getParentId()); +JmsMessageDispatcher dispatcher = null; + +if (envelope.getConsumerInfo() != null && envelope.getConsumerInfo().getDispatcher() != null) { +dispatcher = envelope.getConsumerInfo().getDispatcher(); +} else { +dispatcher = sessions.get(envelope.getConsumerId().getParentId()); +if (dispatcher == null) { +dispatcher = connectionConsumers.get(envelope.getConsumerId()); +} +} + if (dispatcher != null) { dispatcher.onInboundMessage(envelope); } else { -dispatcher = connectionConsumers.get(envelope.getConsumerId()); -if (dispatcher != null) { -dispatcher.onInboundMessage(envelope); -} +LOG.debug("Message inbound with no dispatcher registered for its consumer: {}", envelope.getConsumerId()); } // Run the application callbacks on the connection executor to allow the provider to // return to its normal processing without waiting for client level processing to finish. if (!connectionListeners.isEmpty()) { for (final JmsConnectionListener listener : connectionListeners) { -executor.submit(new Runnable() { - -@Override -public void run() { -listener.onInboundMessage(envelope); -} +
[2/2] qpid-jms git commit: QPIDJMS-420 Refactor the MessageConsumer prefetch queue
QPIDJMS-420 Refactor the MessageConsumer prefetch queue Refactor the MessageQueue based implementations to remove some unused APIs and simplify the interface. Improves performance of the default FifoMessageQueue and separates the implementation from the priority based variant to allow for more efficiencies to be added in. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/d96734e0 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/d96734e0 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/d96734e0 Branch: refs/heads/master Commit: d96734e0f4e3c11245e3aae774ef112b158bacfe Parents: 56b24dc Author: Timothy Bish Authored: Fri Oct 26 16:44:23 2018 -0400 Committer: Timothy Bish Committed: Fri Oct 26 16:44:23 2018 -0400 -- .../qpid/jms/util/AbstractMessageQueue.java | 148 - .../apache/qpid/jms/util/FifoMessageQueue.java | 158 +++ .../org/apache/qpid/jms/util/MessageQueue.java | 43 ++--- .../qpid/jms/util/PriorityMessageQueue.java | 131 ++- .../qpid/jms/util/FifoMessageQueueTest.java | 118 ++ .../qpid/jms/util/PriorityMessageQueueTest.java | 115 +- 6 files changed, 308 insertions(+), 405 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d96734e0/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java deleted file mode 100644 index 788aca3..000 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.jms.util; - -import org.apache.qpid.jms.message.JmsInboundMessageDispatch; - -/** - * Abstract Message Queue class used to implement the common functions of a Message Queue - * instance. - */ -public abstract class AbstractMessageQueue implements MessageQueue { - -private volatile boolean closed; -private volatile boolean running; -private final Object lock = new Object(); - -private int waiters; - -@Override -public final JmsInboundMessageDispatch peek() { -synchronized (lock) { -return peekFirst(); -} -} - -@Override -public final JmsInboundMessageDispatch dequeue(long timeout) throws InterruptedException { -synchronized (lock) { -// Wait until the consumer is ready to deliver messages. -while (timeout != 0 && !closed && isEmpty() && running) { -waiters++; -try { -if (timeout == -1) { -lock.wait(); -} else { -long start = System.currentTimeMillis(); -lock.wait(timeout); -timeout = Math.max(timeout + start - System.currentTimeMillis(), 0); -} -} finally { -waiters--; -} -} - -if (closed || !running || isEmpty()) { -return null; -} - -return removeFirst(); -} -} - -@Override -public final JmsInboundMessageDispatch dequeueNoWait() { -synchronized (lock) { -if (closed || !running || isEmpty()) { -return null; -} -return removeFirst(); -} -} - -@Override -public final void start() { -synchronized (lock) { -if (!closed) { -running = true; -} - -if (hasWaiters()) { -lock.notifyAll(); -} -} -} - -@Override -public final void stop() { -synchronized (lock) { -running = false; -if (hasWaiters()
qpid-jms git commit: QPIDJMS-423 Log only the host and port data from the URI on connect
Repository: qpid-jms Updated Branches: refs/heads/master d96734e0f -> abc75a35e QPIDJMS-423 Log only the host and port data from the URI on connect Update the connection event handler to log only the on-query portion of the URI when processing the event. This closes #23 Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/abc75a35 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/abc75a35 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/abc75a35 Branch: refs/heads/master Commit: abc75a35e22fdfde95511b78d2b020c303bb31a8 Parents: d96734e Author: Timothy Bish Authored: Mon Oct 29 14:45:36 2018 -0400 Committer: Timothy Bish Committed: Mon Oct 29 14:45:36 2018 -0400 -- .../src/main/java/org/apache/qpid/jms/JmsConnection.java| 9 - 1 file changed, 8 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/abc75a35/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index a3537e3..b4e2682 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -18,6 +18,7 @@ package org.apache.qpid.jms; import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -86,6 +87,7 @@ import org.apache.qpid.jms.util.MessageQueue; import org.apache.qpid.jms.util.PriorityMessageQueue; import org.apache.qpid.jms.util.QpidJMSThreadFactory; import org.apache.qpid.jms.util.ThreadPoolUtils; +import org.apache.qpid.jms.util.URISupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1322,7 +1324,12 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection @Override public void onConnectionEstablished(final URI remoteURI) { -LOG.info("Connection {} connected to remote Broker: {}", connectionInfo.getId(), remoteURI); +try { +LOG.info("Connection {} connected to remote Broker: {}", connectionInfo.getId(), URISupport.removeQuery(remoteURI)); +} catch (URISyntaxException e) { +LOG.info("Connection {} connected to remote Broker: {}", connectionInfo.getId()); +} + setMessageFactory(provider.getMessageFactory()); connectionInfo.setConnectedURI(provider.getRemoteURI()); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: QPIDJMS-420 Use local tracking in AmqpConsumer for prefetch refill
Repository: qpid-jms Updated Branches: refs/heads/master abc75a35e -> 24d03437f QPIDJMS-420 Use local tracking in AmqpConsumer for prefetch refill Track the number of message that are currently in the prefetch buffer using local counters that mesh well with the already added delivered message counts to reduce access to synchronized code in the message queue. Reduce code paths where a message settlement might be missed or credit not replenished on error. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/24d03437 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/24d03437 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/24d03437 Branch: refs/heads/master Commit: 24d03437fb1695b2096989c3561007312d4169ee Parents: abc75a3 Author: Timothy Bish Authored: Tue Oct 30 15:48:26 2018 -0400 Committer: Timothy Bish Committed: Tue Oct 30 15:48:26 2018 -0400 -- .../java/org/apache/qpid/jms/JmsConnection.java | 2 +- .../org/apache/qpid/jms/JmsMessageConsumer.java | 2 +- .../apache/qpid/jms/meta/JmsConsumerInfo.java | 11 +- .../qpid/jms/provider/amqp/AmqpConsumer.java| 156 +++ .../qpid/jms/meta/JmsConsumerInfoTest.java | 32 ++-- .../jms/meta/JmsDefaultResourceVisitorTest.java | 2 +- .../amqp/AmqpSubscriptionTrackerTest.java | 2 +- .../provider/amqp/message/AmqpCodecTest.java| 2 +- .../message/AmqpJmsMessageTypesTestCase.java| 2 +- .../failover/FailoverProviderTestSupport.java | 2 +- 10 files changed, 113 insertions(+), 100 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/24d03437/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index b4e2682..da5f704 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -471,7 +471,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection messageQueue = new FifoMessageQueue(configuredPrefetch); } -JmsConsumerInfo consumerInfo = new JmsConsumerInfo(getNextConnectionConsumerId(), messageQueue, null); +JmsConsumerInfo consumerInfo = new JmsConsumerInfo(getNextConnectionConsumerId(), null); consumerInfo.setExplicitClientID(isExplicitClientID()); consumerInfo.setSelector(messageSelector); consumerInfo.setDurable(durable); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/24d03437/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java index 5662b2e..d616faf 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java @@ -100,7 +100,7 @@ public class JmsMessageConsumer implements AutoCloseable, MessageConsumer, JmsMe this.messageQueue = new FifoMessageQueue(configuredPrefetch); } -consumerInfo = new JmsConsumerInfo(consumerId, messageQueue, this); +consumerInfo = new JmsConsumerInfo(consumerId, this); consumerInfo.setExplicitClientID(connection.isExplicitClientID()); consumerInfo.setSelector(selector); consumerInfo.setDurable(isDurableSubscription()); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/24d03437/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java index 7addbb7..edb928a 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java @@ -22,7 +22,6 @@ import org.apache.qpid.jms.policy.JmsDefaultDeserializationPolicy; import org.apache.qpid.jms.policy.JmsDefaultRedeliveryPolicy; import org.apache.qpid.jms.policy.JmsDeserializationPolicy; import org.apache.qpid.jms.policy.JmsRedeliveryPolicy; -import org.apache.qpid.jms.util.MessageQueue; public final class JmsConsumerInfo extends JmsAbstractResource implements Comparable { @@ -42,7 +41,6 @@ public final class JmsConsumerInfo extends JmsAbstractResource implements
qpid-jms git commit: QPIDJMS-387 Update Netty and ActiveMQ to latest releasses
Repository: qpid-jms Updated Branches: refs/heads/master 78892af25 -> b66120798 QPIDJMS-387 Update Netty and ActiveMQ to latest releasses Update to Netty 4.1.25.Final and ActiveMQ 5.15.4 Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/b6612079 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/b6612079 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/b6612079 Branch: refs/heads/master Commit: b661207980ba33a6469b608ef71d73bd02110edf Parents: 78892af Author: Timothy Bish Authored: Mon Jun 4 12:05:59 2018 -0400 Committer: Timothy Bish Committed: Mon Jun 4 12:05:59 2018 -0400 -- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b6612079/pom.xml -- diff --git a/pom.xml b/pom.xml index 4283bab..871bff0 100644 --- a/pom.xml +++ b/pom.xml @@ -40,12 +40,12 @@ 0.27.1 -4.1.24.Final +4.1.25.Final 1.7.25 1.0-alpha-2 -5.15.3 +5.15.4 4.12 1.0 9.4.6.v20170531 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: QPIDJMS-386 Handle errors on link recreate during failover
Repository: qpid-jms Updated Branches: refs/heads/master b66120798 -> 91ababa95 QPIDJMS-386 Handle errors on link recreate during failover Better handle link recreation failures during failover so that on successive attempts to failover the links are tried again and not left in an unknown state. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/91ababa9 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/91ababa9 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/91ababa9 Branch: refs/heads/master Commit: 91ababa9500813886c41170e73984b0245e33ac3 Parents: b661207 Author: Timothy Bish Authored: Wed Jun 6 17:50:48 2018 -0400 Committer: Timothy Bish Committed: Wed Jun 6 17:50:48 2018 -0400 -- .../java/org/apache/qpid/jms/JmsConnection.java | 12 +- .../apache/qpid/jms/JmsConnectionFactory.java | 29 ++ .../org/apache/qpid/jms/JmsMessageConsumer.java | 17 +- .../org/apache/qpid/jms/JmsMessageProducer.java | 15 +- .../java/org/apache/qpid/jms/JmsSession.java| 2 +- .../qpid/jms/meta/JmsAbstractResource.java | 4 +- .../apache/qpid/jms/meta/JmsConnectionInfo.java | 10 + .../org/apache/qpid/jms/meta/JmsResource.java | 3 +- .../jms/provider/amqp/AmqpAbstractResource.java | 2 + .../amqp/builders/AmqpResourceBuilder.java | 2 +- .../failover/FailoverIntegrationTest.java | 483 ++- 11 files changed, 562 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/91ababa9/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index 3b2959e..9f828ab 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -1170,6 +1170,14 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection return connectionInfo.isUseDaemonThread(); } +public boolean isCloseLinksThatFailOnReconnect() { +return connectionInfo.isCloseLinksThatFailOnReconnect(); +} + +public void setCloseLinksThatFailOnReconnect(boolean closeLinksThatFailOnReconnect) { + connectionInfo.setCloseLinksThatFailOnReconnect(closeLinksThatFailOnReconnect); +} + //- Async event handlers -// @Override @@ -1264,7 +1272,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection for (JmsConnectionConsumer connectionConsumer : connectionConsumers.values()) { JmsConsumerInfo consumerInfo = connectionConsumer.getConsumerInfo(); -if (consumerInfo.isOpen()) { +if (!consumerInfo.isClosed()) { request = new ProviderFuture(); provider.create(consumerInfo, request); request.sync(); @@ -1285,7 +1293,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection for (JmsConnectionConsumer connectionConsumer : connectionConsumers.values()) { JmsConsumerInfo consumerInfo = connectionConsumer.getConsumerInfo(); -if (consumerInfo.isOpen()) { +if (!consumerInfo.isClosed()) { ProviderFuture request = new ProviderFuture(); provider.start(consumerInfo, request); request.sync(); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/91ababa9/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java index baecfa9..eb0427d 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java @@ -29,6 +29,7 @@ import javax.jms.ConnectionFactory; import javax.jms.ExceptionListener; import javax.jms.JMSContext; import javax.jms.JMSException; +import javax.jms.MessageListener; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.TopicConnection; @@ -87,6 +88,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact private boolean receiveLocalOnly; private boolean receiveNoWaitLocalOnly; private boolean populateJMSXUserID; +private boolean closeLinksThatFailOnReconnect; private String queuePrefix = null; privat
qpid-jms git commit: QPIDJMS-389 Signal the correct producer completion only
Repository: qpid-jms Updated Branches: refs/heads/master fe4aa6ed9 -> 816773722 QPIDJMS-389 Signal the correct producer completion only Ensure that if more than one producer exists on a session that the remote close of one producer does not trigger completions for the other producer that is waiting for its send to complete. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/81677372 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/81677372 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/81677372 Branch: refs/heads/master Commit: 816773722df3abb23d1bca81aa64f353e57c0a02 Parents: fe4aa6e Author: Timothy Bish Authored: Thu Jun 7 18:47:40 2018 -0400 Committer: Timothy Bish Committed: Thu Jun 7 18:47:40 2018 -0400 -- .../java/org/apache/qpid/jms/JmsSession.java| 22 ++- .../integration/ProducerIntegrationTest.java| 176 ++- 2 files changed, 187 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/81677372/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java index 782050e..b8c88f6 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java @@ -1414,20 +1414,24 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe while (pending.hasNext()) { SendCompletion completion = pending.next(); -if (!completion.hasCompleted()) { -if (producerId == null || producerId.equals(completion.envelope.getProducerId())) { +if (producerId == null || producerId.equals(completion.envelope.getProducerId())) { +if (!completion.hasCompleted()) { completion.markAsFailed(failureCause); } -} -try { -completion.signalCompletion(); -} catch (Throwable error) { -LOG.trace("Signaled completion of send: {}", completion.envelope); +try { +completion.signalCompletion(); +} catch (Throwable error) { +} finally { +LOG.trace("Signaled completion of send: {}", completion.envelope); +} } } -asyncSendQueue.clear(); +// Only clear on non-discriminating variant to avoid losing track of completions. +if (producerId == null) { +asyncSendQueue.clear(); +} } } @@ -1530,6 +1534,8 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe } public void signalCompletion() { +envelope.getMessage().onSendComplete(); // Ensure message is returned as readable. + if (failureCause == null) { listener.onCompletion(envelope.getMessage()); } else { http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/81677372/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java index 7cda887..8a8a96c 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java @@ -2397,7 +2397,6 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { @Override public void onCompletion(Message message) { - try { session.close(); } catch (JMSException jmsEx) { @@ -2761,7 +2760,7 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { MessageProducer producer = session.createProducer(queue); int delay = 0; -if(deliveryDelay) { +if (deliveryDelay) { delay = 123456; producer.setDeliveryDelay(delay); } @@ -2777,7 +2776,7 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { TransferPayloadCompositeMatcher messageMatcher = new TransferPayloadCompositeMatcher(); messageMatcher.setHeadersMa
qpid-jms git commit: QPIDJMS-390 Use an atomic int field updater in ProviderFuture
Repository: qpid-jms Updated Branches: refs/heads/master 816773722 -> 615fb0848 QPIDJMS-390 Use an atomic int field updater in ProviderFuture Avoid allocation of AtomicBoolean instances for each ProviderFuture instance and instead use an Atomic field updater to reduce GC overhead Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/615fb084 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/615fb084 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/615fb084 Branch: refs/heads/master Commit: 615fb084877c430c2d040427d78423ac8bab245b Parents: 8167737 Author: Timothy Bish Authored: Fri Jun 8 13:09:43 2018 -0400 Committer: Timothy Bish Committed: Fri Jun 8 13:09:43 2018 -0400 -- .../org/apache/qpid/jms/provider/ProviderFuture.java | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/615fb084/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java index 61168d4..01b3c6e 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java @@ -19,7 +19,7 @@ package org.apache.qpid.jms.provider; import java.io.IOException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import org.apache.qpid.jms.util.IOExceptionSupport; @@ -28,11 +28,16 @@ import org.apache.qpid.jms.util.IOExceptionSupport; */ public class ProviderFuture implements AsyncResult { -private final AtomicBoolean completer = new AtomicBoolean(); +private static final AtomicIntegerFieldUpdater COMPLETE_UPDATER = +AtomicIntegerFieldUpdater.newUpdater(ProviderFuture.class, "complete"); + private final CountDownLatch latch = new CountDownLatch(1); private final ProviderSynchronization synchronization; private volatile Throwable error; +@SuppressWarnings("unused") +private volatile int complete; + public ProviderFuture() { this(null); } @@ -48,7 +53,7 @@ public class ProviderFuture implements AsyncResult { @Override public void onFailure(Throwable result) { -if (completer.compareAndSet(false, true)) { +if (COMPLETE_UPDATER.compareAndSet(this, 0, 1)) { error = result; if (synchronization != null) { synchronization.onPendingFailure(error); @@ -59,7 +64,7 @@ public class ProviderFuture implements AsyncResult { @Override public void onSuccess() { -if (completer.compareAndSet(false, true)) { +if (COMPLETE_UPDATER.compareAndSet(this, 0, 1)) { if (synchronization != null) { synchronization.onPendingSuccess(); } - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: NO-JIRA Fix spelling in test support class API
Repository: qpid-jms Updated Branches: refs/heads/master 615fb0848 -> 8aa05509f NO-JIRA Fix spelling in test support class API Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/8aa05509 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/8aa05509 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/8aa05509 Branch: refs/heads/master Commit: 8aa05509f169cd92f87507c4423bfb616534c892 Parents: 615fb08 Author: Timothy Bish Authored: Fri Jun 8 14:51:31 2018 -0400 Committer: Timothy Bish Committed: Fri Jun 8 14:51:31 2018 -0400 -- .../qpid/jms/JmsConnectionFailedTest.java | 2 +- .../consumer/JmsMessageConsumerFailedTest.java | 2 +- .../ConnectionConsumerIntegrationTest.java | 2 +- .../integration/ConnectionIntegrationTest.java | 2 +- .../integration/ConsumerIntegrationTest.java| 6 ++--- .../integration/IdleTimeoutIntegrationTest.java | 2 +- .../integration/JMSConsumerIntegrationTest.java | 2 +- .../integration/ProducerIntegrationTest.java| 2 +- .../jms/integration/SessionIntegrationTest.java | 8 +++--- .../producer/JmsMessageProducerFailedTest.java | 2 +- .../jms/producer/JmsMessageProducerTest.java| 24 - .../failover/FailoverIntegrationTest.java | 6 ++--- .../provider/failover/FailoverProviderTest.java | 4 +-- .../qpid/jms/session/JmsSessionFailedTest.java | 2 +- .../java/org/apache/qpid/jms/test/Wait.java | 11 .../transports/netty/NettyTcpTransportTest.java | 8 +++--- .../transports/netty/NettyWsTransportTest.java | 6 ++--- .../qpid/jms/consumer/JmsAutoAckTest.java | 4 +-- .../qpid/jms/consumer/JmsClientAckTest.java | 26 +- .../jms/consumer/JmsDurableSubscriberTest.java | 4 +-- .../jms/consumer/JmsMessageConsumerTest.java| 10 +++ .../qpid/jms/consumer/JmsZeroPrefetchTest.java | 8 +++--- .../jms/discovery/JmsAmqpDiscoveryTest.java | 8 +++--- .../qpid/jms/failover/JmsFailoverTest.java | 28 ++-- .../jms/failover/JmsOfflineBehaviorTests.java | 4 +-- .../jms/failover/JmsTxConsumerFailoverTest.java | 4 +-- .../jms/failover/JmsTxProducerFailoverTest.java | 4 +-- .../jms/producer/JmsMessageProducerTest.java| 2 +- ...JmsProducerFlowControlFailIfNoSpaceTest.java | 2 +- .../apache/qpid/jms/session/JmsSessionTest.java | 4 +-- .../java/org/apache/qpid/jms/support/Wait.java | 11 .../JmsTransactionRedeliveryPolicyTest.java | 4 +-- 32 files changed, 106 insertions(+), 108 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8aa05509/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFailedTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFailedTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFailedTest.java index 0bf8a91..961c84b 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFailedTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionFailedTest.java @@ -48,7 +48,7 @@ public class JmsConnectionFailedTest extends JmsConnectionClosedTest { assertTrue(Wait.waitFor(new Wait.Condition() { @Override -public boolean isSatisified() throws Exception { +public boolean isSatisfied() throws Exception { return !jmsConnection.isConnected(); } }, TimeUnit.SECONDS.toMillis(30), TimeUnit.MILLISECONDS.toMillis(10))); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8aa05509/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsMessageConsumerFailedTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsMessageConsumerFailedTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsMessageConsumerFailedTest.java index ce86809..1700648 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsMessageConsumerFailedTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsMessageConsumerFailedTest.java @@ -54,7 +54,7 @@ public class JmsMessageConsumerFailedTest extends JmsMessageConsumerClosedTest { assertTrue(Wait.waitFor(new Wait.Condition() { @Override -public boolean isSatisified() throws Exception { +public boolean isSatisfied() throws Exception { return !jmsConnection.isConnected(); } }, TimeUnit.SECONDS.toMillis(30), TimeUnit.MILLISECONDS.toMillis(2))); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8aa05509/qpid-jms-client/src/test/java/org/apache/q
qpid-jms git commit: QPIDJMS-393 Signal async completion when TX is in-doubt
Repository: qpid-jms Updated Branches: refs/heads/master aecee9935 -> 7226605a7 QPIDJMS-393 Signal async completion when TX is in-doubt Send an onCompletion event to any caller using the async completion API for sending messages when a TX has been tagged as in-doubt Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/7226605a Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/7226605a Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/7226605a Branch: refs/heads/master Commit: 7226605a7f478ce45a858a6791f961511d0e2180 Parents: aecee99 Author: Timothy Bish Authored: Tue Jun 12 13:04:21 2018 -0400 Committer: Timothy Bish Committed: Tue Jun 12 13:04:21 2018 -0400 -- .../qpid/jms/JmsLocalTransactionContext.java| 4 + .../failover/FailoverIntegrationTest.java | 133 +++ 2 files changed, 137 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/7226605a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java index 936d76c..bf13888 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java @@ -60,6 +60,10 @@ public class JmsLocalTransactionContext implements JmsTransactionContext { lock.readLock().lock(); try { if (isInDoubt()) { +// Ensure that asynchronous completions get signaled while TX is in doubt +if (envelope.isCompletionRequired()) { +connection.onCompletedMessageSend(envelope); +} return; } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/7226605a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index b8aa42c..99b47dd 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -56,6 +56,7 @@ import javax.jms.Session; import javax.jms.TemporaryTopic; import javax.jms.TextMessage; import javax.jms.Topic; +import javax.jms.TransactionRolledBackException; import org.apache.qpid.jms.JmsConnection; import org.apache.qpid.jms.JmsConnectionFactory; @@ -73,8 +74,10 @@ import org.apache.qpid.jms.test.testpeer.basictypes.ConnectionError; import org.apache.qpid.jms.test.testpeer.basictypes.TerminusDurability; import org.apache.qpid.jms.test.testpeer.describedtypes.Accepted; import org.apache.qpid.jms.test.testpeer.describedtypes.Rejected; +import org.apache.qpid.jms.test.testpeer.describedtypes.TransactionalState; import org.apache.qpid.jms.test.testpeer.describedtypes.sections.AmqpValueDescribedType; import org.apache.qpid.jms.test.testpeer.matchers.SourceMatcher; +import org.apache.qpid.jms.test.testpeer.matchers.TransactionalStateMatcher; import org.apache.qpid.jms.test.testpeer.matchers.sections.MessageAnnotationsSectionMatcher; import org.apache.qpid.jms.test.testpeer.matchers.sections.MessageHeaderSectionMatcher; import org.apache.qpid.jms.test.testpeer.matchers.sections.MessagePropertiesSectionMatcher; @@ -2515,6 +2518,136 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { } } +@Test(timeout = 2) +public void testInDoubtTransactionFromFailoverCompletesAsyncCompletions() throws Exception { +try (TestAmqpPeer originalPeer = new TestAmqpPeer(); + TestAmqpPeer finalPeer = new TestAmqpPeer();) { + +final CountDownLatch originalConnected = new CountDownLatch(1); +final CountDownLatch finalConnected = new CountDownLatch(1); + +// Create a peer to connect to, then one to reconnect to +final String originalURI = createPeerURI(originalPeer); +final String finalURI = createPeerURI(finalPeer); + +LOG.info("Original peer is at: {}", originalURI); +LOG.info("Final peer is at: {}", finalURI); + +Binary txnId = new Binary(new byte[]{ (byte) 5, (byte) 6, (byte) 7, (byte) 8}); + +// Expect the message which was sent under the current transaction.
qpid-jms git commit: QPIDJMS-394 Fix failover wrongly signalling async completion
Repository: qpid-jms Updated Branches: refs/heads/master 7226605a7 -> e676248c7 QPIDJMS-394 Fix failover wrongly signalling async completion Ensure that an inflight async completion that is held in the Failover provider is not signaled as failed by the session during connection recovery. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/e676248c Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/e676248c Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/e676248c Branch: refs/heads/master Commit: e676248c74e9747031e5a89a640442bb51ffcb28 Parents: 7226605 Author: Timothy Bish Authored: Tue Jun 12 15:24:32 2018 -0400 Committer: Timothy Bish Committed: Tue Jun 12 15:24:32 2018 -0400 -- .../java/org/apache/qpid/jms/JmsConnection.java | 4 -- .../qpid/jms/JmsLocalTransactionContext.java| 12 +++- .../qpid/jms/JmsNoTxTransactionContext.java | 5 +- .../java/org/apache/qpid/jms/JmsSession.java| 31 + .../apache/qpid/jms/JmsTransactionContext.java | 5 +- .../failover/FailoverIntegrationTest.java | 68 6 files changed, 101 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e676248c/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index 9f828ab..338ad5d 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -760,10 +760,6 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection } } -void send(JmsOutboundMessageDispatch envelope) throws JMSException { -send(envelope, null); -} - void send(JmsOutboundMessageDispatch envelope, ProviderSynchronization synchronization) throws JMSException { checkClosedOrFailed(); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e676248c/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java index bf13888..c60c5e6 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java @@ -56,10 +56,14 @@ public class JmsLocalTransactionContext implements JmsTransactionContext { } @Override -public void send(JmsConnection connection, final JmsOutboundMessageDispatch envelope) throws JMSException { +public void send(JmsConnection connection, final JmsOutboundMessageDispatch envelope, ProviderSynchronization outcome) throws JMSException { lock.readLock().lock(); try { if (isInDoubt()) { +// Need to signal that the request is going to pass before completing +if (outcome != null) { +outcome.onPendingSuccess(); +} // Ensure that asynchronous completions get signaled while TX is in doubt if (envelope.isCompletionRequired()) { connection.onCompletedMessageSend(envelope); @@ -74,12 +78,18 @@ public class JmsLocalTransactionContext implements JmsTransactionContext { public void onPendingSuccess() { LOG.trace("TX:{} has performed a send.", getTransactionId()); participants.put(envelope.getProducerId(), envelope.getProducerId()); +if (outcome != null) { +outcome.onPendingSuccess(); +} } @Override public void onPendingFailure(Throwable cause) { LOG.trace("TX:{} has a failed send.", getTransactionId()); participants.put(envelope.getProducerId(), envelope.getProducerId()); +if (outcome != null) { +outcome.onPendingFailure(cause); +} } }); } finally { http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e676248c/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsNoTxTransactionContext.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsNoTxTransactionContext.java b/qpid-jms-client/sr
qpid-jms git commit: QPIDJMS-395 Add failed state in provider to prevent possible race
Repository: qpid-jms Updated Branches: refs/heads/master e676248c7 -> 4bfe7f5ae QPIDJMS-395 Add failed state in provider to prevent possible race Adds a failed state to the AMQP provider such that any queued actions such as a send which race into the provider between the time a connection error is detected and the failover bits close the provider received a consistent exception that allows normal failover processing to occur. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/4bfe7f5a Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/4bfe7f5a Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/4bfe7f5a Branch: refs/heads/master Commit: 4bfe7f5ae60680d220dbe2b7cbcfeb824b5e6e9d Parents: e676248 Author: Timothy Bish Authored: Tue Jun 19 15:03:15 2018 -0400 Committer: Timothy Bish Committed: Tue Jun 19 15:03:15 2018 -0400 -- .../java/org/apache/qpid/jms/JmsConnection.java | 5 +- .../jms/provider/ProviderFailedException.java | 32 ++ .../qpid/jms/provider/amqp/AmqpProvider.java| 62 +++- 3 files changed, 70 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4bfe7f5a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index 338ad5d..52c314d 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -78,6 +78,7 @@ import org.apache.qpid.jms.provider.AsyncResult; import org.apache.qpid.jms.provider.Provider; import org.apache.qpid.jms.provider.ProviderClosedException; import org.apache.qpid.jms.provider.ProviderConstants.ACK_TYPE; +import org.apache.qpid.jms.provider.ProviderFailedException; import org.apache.qpid.jms.provider.ProviderFuture; import org.apache.qpid.jms.provider.ProviderListener; import org.apache.qpid.jms.provider.ProviderSynchronization; @@ -229,8 +230,8 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection } LOG.debug("Failed destroying Connection resource: {}", ex.getMessage()); } -} catch(ProviderClosedException pce) { -LOG.debug("Ignoring provider closed exception during connection close"); +} catch(ProviderClosedException | ProviderFailedException pfe) { +LOG.debug("Ignoring provider exception during connection close"); } finally { requests.remove(request); } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4bfe7f5a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFailedException.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFailedException.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFailedException.java new file mode 100644 index 000..702dbb4 --- /dev/null +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFailedException.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.qpid.jms.provider; + +import java.io.IOException; + +public class ProviderFailedException extends IOException { + +private static final long serialVersionUID = 1L; + +public ProviderFailedException(String message) { +super(message); +} + +public ProviderFailedException(String message, Throwable cause) { +super(message, cause); +} +} http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4bfe7f5a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java -
qpid-jms git commit: QPIDJMS-395 Throw a more descriptive exception type when forced
Repository: qpid-jms Updated Branches: refs/heads/master 4bfe7f5ae -> 384599110 QPIDJMS-395 Throw a more descriptive exception type when forced Use a somewhat more descriptive exception type when the connection is remotely closed due to a forced error condition to aid in debug. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/38459911 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/38459911 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/38459911 Branch: refs/heads/master Commit: 3845991106aaad1421fbf3bdb4375f367c2ac9cd Parents: 4bfe7f5 Author: Timothy Bish Authored: Tue Jun 19 19:04:20 2018 -0400 Committer: Timothy Bish Committed: Tue Jun 19 19:04:20 2018 -0400 -- .../JmsConnectionRemotelyClosedException.java | 36 + .../qpid/jms/provider/amqp/AmqpSupport.java | 3 ++ .../integration/ConnectionIntegrationTest.java | 42 +++- 3 files changed, 80 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/38459911/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionRemotelyClosedException.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionRemotelyClosedException.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionRemotelyClosedException.java new file mode 100644 index 000..0aa39f5 --- /dev/null +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionRemotelyClosedException.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.qpid.jms; + +import javax.jms.JMSException; + +/** + * Thrown when the remote peer closes the connection with amqp:connection:forced + * signaling that the connection is closed. + */ +public class JmsConnectionRemotelyClosedException extends JMSException { + +private static final long serialVersionUID = -4811726481264524424L; + +public JmsConnectionRemotelyClosedException(String reason) { +super(reason); +} + +public JmsConnectionRemotelyClosedException(String reason, String errorCode) { +super(reason, errorCode); +} +} http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/38459911/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSupport.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSupport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSupport.java index 62c5001..f93d49f 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSupport.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSupport.java @@ -26,6 +26,7 @@ import javax.jms.JMSSecurityException; import javax.jms.ResourceAllocationException; import javax.jms.TransactionRolledBackException; +import org.apache.qpid.jms.JmsConnectionRemotelyClosedException; import org.apache.qpid.jms.JmsResourceNotFoundException; import org.apache.qpid.jms.provider.ProviderRedirectedException; import org.apache.qpid.proton.amqp.Symbol; @@ -143,6 +144,8 @@ public class AmqpSupport { remoteError = new JMSSecurityException(message); } else if (error.equals(AmqpError.RESOURCE_LIMIT_EXCEEDED)) { remoteError = new ResourceAllocationException(message); +} else if (error.equals(ConnectionError.CONNECTION_FORCED)) { +remoteError = new JmsConnectionRemotelyClosedException(message); } else if (error.equals(AmqpError.NOT_FOUND)) { if (endpoint instanceof Connection) { remoteError = new JmsResourceNotFoundException(message); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/38459911/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java --
qpid-jms git commit: QPIDJMS-393 Fix test repetitions count not reset to one
Repository: qpid-jms Updated Branches: refs/heads/master 384599110 -> 7a4169f9f QPIDJMS-393 Fix test repetitions count not reset to one Reduce to one repetition from value left in during local testing. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/7a4169f9 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/7a4169f9 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/7a4169f9 Branch: refs/heads/master Commit: 7a4169f9f5c5ceba7ffda5c2bf85ae725f0bec37 Parents: 3845991 Author: Timothy Bish Authored: Wed Jun 20 11:36:33 2018 -0400 Committer: Timothy Bish Committed: Wed Jun 20 11:36:33 2018 -0400 -- .../apache/qpid/jms/provider/failover/FailoverIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/7a4169f9/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index f117fc3..5e4e9d2 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -2652,7 +2652,7 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { } } -@Repeat(repetitions = 100) +@Repeat(repetitions = 1) @Test(timeout = 2) public void testFailoverDoesNotFailPendingAsyncCompletionSend() throws Exception { try (TestAmqpPeer originalPeer = new TestAmqpPeer(); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: NO-JIRA Fix race in test on link remote close
Repository: qpid-jms Updated Branches: refs/heads/master 1ba08 -> 1549eecbe NO-JIRA Fix race in test on link remote close Ensure that setMessageListener doesn't race the link close by using a zero prefetch to cause the set to send the link credit. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/1549eecb Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/1549eecb Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/1549eecb Branch: refs/heads/master Commit: 1549eecbe61797a2fa8423be36af76c54891bf9e Parents: 1ba Author: Timothy Bish Authored: Thu Jun 21 11:25:39 2018 -0400 Committer: Timothy Bish Committed: Thu Jun 21 11:28:35 2018 -0400 -- .../org/apache/qpid/jms/integration/ConsumerIntegrationTest.java | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1549eecb/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java index 1543f3a..fbc0e41 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java @@ -220,6 +220,9 @@ public class ConsumerIntegrationTest extends QpidJmsTestCase { } }); +// Use a zero prefetch to allow setMessageListener to not race link close +((JmsDefaultPrefetchPolicy) connection.getPrefetchPolicy()).setAll(0); + testPeer.expectBegin(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: QPIDJMS-395 Adding additional failover handling tests
Repository: qpid-jms Updated Branches: refs/heads/master 1549eecbe -> 09546c553 QPIDJMS-395 Adding additional failover handling tests Add new test that validates reconnect on error after a successful connection was made and the next reconnect has its open attempt rejected. Client should reconnect to final peer and return to normal operation. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/09546c55 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/09546c55 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/09546c55 Branch: refs/heads/master Commit: 09546c553c0a8fccedcc36b73e4ef33d42ceff7f Parents: 1549eec Author: Timothy Bish Authored: Thu Jun 21 18:13:31 2018 -0400 Committer: Timothy Bish Committed: Thu Jun 21 18:13:31 2018 -0400 -- .../failover/FailoverIntegrationTest.java | 114 +++ 1 file changed, 114 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/09546c55/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index 5e4e9d2..8aa8b1f 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -124,6 +124,120 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { } @Test(timeout = 2) +public void testFailoverHandlesConnectErrorInvalidField() throws Exception { + +try (TestAmqpPeer originalPeer = new TestAmqpPeer(); + TestAmqpPeer finalPeer = new TestAmqpPeer();) { + +final CountDownLatch finalConnected = new CountDownLatch(1); +final String finalURI = createPeerURI(finalPeer); +final DescribedType amqpValueNullContent = new AmqpValueDescribedType(null); + +originalPeer.rejectConnect(AmqpError.INVALID_FIELD, "Client ID already in use", null); + +finalPeer.expectSaslAnonymous(); +finalPeer.expectOpen(); +finalPeer.expectBegin(); + +final JmsConnection connection = establishAnonymousConnecton(originalPeer, finalPeer); +connection.addConnectionListener(new JmsDefaultConnectionListener() { +@Override +public void onConnectionEstablished(URI remoteURI) { +LOG.info("Connection Established: {}", remoteURI); +if (finalURI.equals(remoteURI.toString())) { +finalConnected.countDown(); +} +} +}); + +try { +connection.start(); +} catch (Exception ex) { +fail("Should not have thrown an Exception: " + ex); +} + +assertTrue("Should connect to final peer", finalConnected.await(5, TimeUnit.SECONDS)); + +finalPeer.expectBegin(); +finalPeer.expectReceiverAttach(); +finalPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueNullContent); +finalPeer.expectDispositionThatIsAcceptedAndSettled(); + +Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); +Queue queue = session.createQueue("myQueue"); +MessageConsumer consumer = session.createConsumer(queue); +Message message = consumer.receive(2000); + +assertNotNull(message); + +// Shut it down +finalPeer.expectClose(); +connection.close(); +finalPeer.waitForAllHandlersToComplete(1000); +} +} + +@Test(timeout = 2) +public void testFailoverHandlesConnectErrorInvalidFieldOnReconnect() throws Exception { + +try (TestAmqpPeer originalPeer = new TestAmqpPeer(); + TestAmqpPeer rejectingPeer = new TestAmqpPeer(); + TestAmqpPeer finalPeer = new TestAmqpPeer();) { + +final CountDownLatch finalConnected = new CountDownLatch(1); +final String finalURI = createPeerURI(finalPeer); +final DescribedType amqpValueNullContent = new AmqpValueDescribedType(null); + +originalPeer.expectSaslAnonymous(); +originalPeer.expectOpen(); +originalPeer.expectBegin(); +originalPeer.dropAfterLastHandler(10); + +rejectingPeer.rejectConnect(AmqpError.INVALID_FIELD, "Client ID already in use", null); + +finalPeer.exp
qpid-jms git commit: QPIDJMS-396 Allow for faster reaction times on sync operations
Repository: qpid-jms Updated Branches: refs/heads/master 02c76f64c -> c66d88811 QPIDJMS-396 Allow for faster reaction times on sync operations For sync operations from the JMS layer into the provider we can more quickly process the events by using a spin-wait future that checks in a short spin for the completion of the target event. The spin will back off and eventually back down to a parked wait that will be signalled by the normal wait / notify pattern. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/c66d8881 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/c66d8881 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/c66d8881 Branch: refs/heads/master Commit: c66d888114021da31d9032c841c08903dd31cc89 Parents: 02c76f6 Author: Timothy Bish Authored: Mon Jun 25 13:05:07 2018 -0400 Committer: Timothy Bish Committed: Mon Jun 25 13:05:07 2018 -0400 -- .../qpid/jms/provider/ProviderFuture.java | 164 --- .../qpid/jms/provider/ProviderFutureTest.java | 11 ++ 2 files changed, 156 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c66d8881/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java index 01b3c6e..c708593 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java @@ -17,9 +17,9 @@ package org.apache.qpid.jms.provider; import java.io.IOException; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; +import java.util.concurrent.locks.LockSupport; import org.apache.qpid.jms.util.IOExceptionSupport; @@ -28,15 +28,30 @@ import org.apache.qpid.jms.util.IOExceptionSupport; */ public class ProviderFuture implements AsyncResult { -private static final AtomicIntegerFieldUpdater COMPLETE_UPDATER = -AtomicIntegerFieldUpdater.newUpdater(ProviderFuture.class, "complete"); +// Using a progressive wait strategy helps to avoid await happening before countDown +// and avoids expensive thread signaling +private static final int SPIN_COUNT = 10; +private static final int YIELD_COUNT = 100; +private static final int TINY_PARK_COUNT = 1000; +private static final int TINY_PARK_NANOS = 1; +private static final int SMALL_PARK_COUNT = 101_000; +private static final int SMALL_PARK_NANOS = 10_000; -private final CountDownLatch latch = new CountDownLatch(1); -private final ProviderSynchronization synchronization; +// States used to track progress of this future +private static final int INCOMPLETE = 0; +private static final int COMPLETING = 1; +private static final int SUCCESS = 2; +private static final int FAILURE = 3; + +private static final AtomicIntegerFieldUpdater STATE_FIELD_UPDATER = +AtomicIntegerFieldUpdater.newUpdater(ProviderFuture.class,"state"); + +private volatile int state = INCOMPLETE; private volatile Throwable error; -@SuppressWarnings("unused") -private volatile int complete; +private int waiting; + +private final ProviderSynchronization synchronization; public ProviderFuture() { this(null); @@ -48,27 +63,41 @@ public class ProviderFuture implements AsyncResult { @Override public boolean isComplete() { -return latch.getCount() == 0; +return state > COMPLETING; } @Override public void onFailure(Throwable result) { -if (COMPLETE_UPDATER.compareAndSet(this, 0, 1)) { +if (STATE_FIELD_UPDATER.compareAndSet(this, INCOMPLETE, COMPLETING)) { error = result; if (synchronization != null) { synchronization.onPendingFailure(error); } -latch.countDown(); + +STATE_FIELD_UPDATER.lazySet(this, FAILURE); + +synchronized(this) { +if (waiting > 0) { +notifyAll(); +} +} } } @Override public void onSuccess() { -if (COMPLETE_UPDATER.compareAndSet(this, 0, 1)) { +if (STATE_FIELD_UPDATER.compareAndSet(this, INCOMPLETE, COMPLETING)) { if (synchronization != null) { synchronization.onPendingSuccess(); } -latch.countDown(); + +STATE_FIELD_UPDATER.lazySet(this, SUCCESS); + +synchron
qpid-jms git commit: QPIDJMS-395 Resend message in flight when remote closed
Repository: qpid-jms Updated Branches: refs/heads/master c66d88811 -> fe0307b58 QPIDJMS-395 Resend message in flight when remote closed When the remote closes the connection and an inflight send is outstanding we should handle the close and resend those messages that are still awaiting dispositions in the same manner as we do when the connection unexpectedly drops when using the Failover feature. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/fe0307b5 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/fe0307b5 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/fe0307b5 Branch: refs/heads/master Commit: fe0307b58beb7ec344f728e34a7ca0e3ef103add Parents: c66d888 Author: Timothy Bish Authored: Mon Jun 25 13:38:30 2018 -0400 Committer: Timothy Bish Committed: Mon Jun 25 13:38:30 2018 -0400 -- .../java/org/apache/qpid/jms/JmsConnection.java | 5 +- .../jms/provider/ProviderClosedException.java | 8 +- .../qpid/jms/provider/ProviderException.java| 32 ++ .../jms/provider/ProviderFailedException.java | 4 +- .../provider/ProviderRedirectedException.java | 2 +- .../ProviderResourceClosedException.java| 30 ++ .../qpid/jms/provider/amqp/AmqpConnection.java | 21 .../failover/FailoverIntegrationTest.java | 105 ++- 8 files changed, 195 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fe0307b5/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index 52c314d..7d09a9c 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -76,9 +76,8 @@ import org.apache.qpid.jms.policy.JmsPresettlePolicy; import org.apache.qpid.jms.policy.JmsRedeliveryPolicy; import org.apache.qpid.jms.provider.AsyncResult; import org.apache.qpid.jms.provider.Provider; -import org.apache.qpid.jms.provider.ProviderClosedException; import org.apache.qpid.jms.provider.ProviderConstants.ACK_TYPE; -import org.apache.qpid.jms.provider.ProviderFailedException; +import org.apache.qpid.jms.provider.ProviderException; import org.apache.qpid.jms.provider.ProviderFuture; import org.apache.qpid.jms.provider.ProviderListener; import org.apache.qpid.jms.provider.ProviderSynchronization; @@ -230,7 +229,7 @@ public class JmsConnection implements AutoCloseable, Connection, TopicConnection } LOG.debug("Failed destroying Connection resource: {}", ex.getMessage()); } -} catch(ProviderClosedException | ProviderFailedException pfe) { +} catch(ProviderException prodiverError) { LOG.debug("Ignoring provider exception during connection close"); } finally { requests.remove(request); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fe0307b5/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderClosedException.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderClosedException.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderClosedException.java index 0fbf753..cc7c140 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderClosedException.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderClosedException.java @@ -16,13 +16,15 @@ */ package org.apache.qpid.jms.provider; -import java.io.IOException; - -public class ProviderClosedException extends IOException { +public class ProviderClosedException extends ProviderException { private static final long serialVersionUID = 1L; public ProviderClosedException(String message) { super(message); } + +public ProviderClosedException(String message, Throwable cause) { +super(message, cause); +} } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fe0307b5/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderException.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderException.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderException.java new file mode 100644 index 000..e680df6 --- /dev/null +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/Pro
qpid-jms git commit: QPIDJMS-397 Update to the current v19 Apache parent pom
Repository: qpid-jms Updated Branches: refs/heads/master ecff6e001 -> 7c5debd00 QPIDJMS-397 Update to the current v19 Apache parent pom Update to latest pom to capture latest plugins and align with other apache Java components. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/7c5debd0 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/7c5debd0 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/7c5debd0 Branch: refs/heads/master Commit: 7c5debd0009fe5c49761fd5f646e7b3a2f64c6e6 Parents: ecff6e0 Author: Timothy Bish Authored: Tue Jun 26 15:39:53 2018 -0400 Committer: Timothy Bish Committed: Tue Jun 26 15:41:12 2018 -0400 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/7c5debd0/pom.xml -- diff --git a/pom.xml b/pom.xml index bae252c..3e94b46 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ org.apache apache -18 +19 4.0.0 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: QPIDJMS-398 Update dependencies to latest
Repository: qpid-jms Updated Branches: refs/heads/master 7c5debd00 -> e745e2a87 QPIDJMS-398 Update dependencies to latest Update Mockito, Jetty and the bundle plugin. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/e745e2a8 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/e745e2a8 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/e745e2a8 Branch: refs/heads/master Commit: e745e2a875ef780dd7f7c477db505c66f4243a48 Parents: 7c5debd Author: Timothy Bish Authored: Tue Jun 26 15:52:30 2018 -0400 Committer: Timothy Bish Committed: Tue Jun 26 15:52:30 2018 -0400 -- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e745e2a8/pom.xml -- diff --git a/pom.xml b/pom.xml index 3e94b46..91133e0 100644 --- a/pom.xml +++ b/pom.xml @@ -48,8 +48,8 @@ 5.15.4 4.12 1.0 -9.4.6.v20170531 -2.18.3 +9.4.11.v20180605 +2.19.0 1.3 2.9.0 @@ -57,7 +57,7 @@ 2.6 2.10 2.5 -3.2.0 +3.5.0 3.0.2 0.8.1 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton-j git commit: PROTON-1876 Expose the encode / decode methods using buffers
Repository: qpid-proton-j Updated Branches: refs/heads/master 311af5e39 -> 32cc5120f PROTON-1876 Expose the encode / decode methods using buffers Expose the encode and decode methods that use WritableBuffer and ReadableBuffer on the Message interface to allow clients to use newer no-copy variants of the API easier. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/32cc5120 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/32cc5120 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/32cc5120 Branch: refs/heads/master Commit: 32cc5120f3c22be5111c09b6143c9f4395c2d4eb Parents: 311af5e Author: Timothy Bish Authored: Wed Jun 27 15:59:43 2018 -0400 Committer: Timothy Bish Committed: Wed Jun 27 15:59:43 2018 -0400 -- .../org/apache/qpid/proton/message/Message.java | 30 +++- .../proton/message/impl/MessageImplTest.java| 30 2 files changed, 59 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/32cc5120/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java b/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java index 41945fa..db290e3 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java @@ -27,7 +27,8 @@ import org.apache.qpid.proton.amqp.messaging.Header; import org.apache.qpid.proton.amqp.messaging.MessageAnnotations; import org.apache.qpid.proton.amqp.messaging.Properties; import org.apache.qpid.proton.amqp.messaging.Section; - +import org.apache.qpid.proton.codec.ReadableBuffer; +import org.apache.qpid.proton.codec.WritableBuffer; import org.apache.qpid.proton.message.impl.MessageImpl; /** @@ -169,6 +170,18 @@ public interface Message int decode(byte[] data, int offset, int length); /** + * Decodes the Message from the given {@link ReadableBuffer}. + * + * If the buffer given does not contain the fully encoded Message bytes for decode + * this method will throw an exception to indicate the buffer underflow condition and + * the message object will be left in an undefined state. + * + * @param buffer + * A {@link ReadableBuffer} that contains the complete message bytes. + */ +void decode(ReadableBuffer buffer); + +/** * Encodes up to {@code length} bytes of the message into the provided byte array, * starting at position {@code offset}. * @@ -179,6 +192,21 @@ public interface Message */ int encode(byte[] data, int offset, int length); +/** + * Encodes the current Message contents into the given {@link WritableBuffer} instance. + * + * This method attempts to encode all message data into the {@link WritableBuffer} and + * if the buffer has insufficient space it will throw an exception to indicate the buffer + * overflow condition. If successful the method returns the number of bytes written to + * the provided buffer to fully encode the message. + * + * @param buffer + * The {@link WritableBuffer} instance to encode the message contents into. + * + * @return the number of bytes written to fully encode the message. + */ +int encode(WritableBuffer buffer); + void clear(); MessageError getError(); http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/32cc5120/proton-j/src/test/java/org/apache/qpid/proton/message/impl/MessageImplTest.java -- diff --git a/proton-j/src/test/java/org/apache/qpid/proton/message/impl/MessageImplTest.java b/proton-j/src/test/java/org/apache/qpid/proton/message/impl/MessageImplTest.java index 6070745..0c0c003 100644 --- a/proton-j/src/test/java/org/apache/qpid/proton/message/impl/MessageImplTest.java +++ b/proton-j/src/test/java/org/apache/qpid/proton/message/impl/MessageImplTest.java @@ -27,6 +27,8 @@ import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.messaging.Data; +import org.apache.qpid.proton.codec.WritableBuffer; +import org.apache.qpid.proton.codec.WritableBuffer.ByteBufferWrapper; import org.apache.qpid.proton.message.Message; import org.junit.Test; @@ -62,6 +64,34 @@ public class MessageImplTest assertEquals("Encoded length different than expected length", encodedLength, encodedBytes.length); } +@Test +public void testEncodeOfMessageWithSmallDataBodyOnlyUsingWritableBuffer() +{ +doMessageEncodingWithDataBodySectionTestImp
qpid-jms git commit: QPIDJMS-399 Split write and flush of data into two operations
Repository: qpid-jms Updated Branches: refs/heads/master 856e2b9ac -> 7750a1c27 QPIDJMS-399 Split write and flush of data into two operations Allow for split write and then flush of outbound data which allows for quicker release of blocking operations where the flush can be done after the caller has been notified of success or a batch of writes could improve performance. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/7750a1c2 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/7750a1c2 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/7750a1c2 Branch: refs/heads/master Commit: 7750a1c27589261b197d7b746506e19d8771b145 Parents: 856e2b9 Author: Timothy Bish Authored: Thu Jun 28 15:09:45 2018 -0400 Committer: Timothy Bish Committed: Thu Jun 28 15:09:45 2018 -0400 -- .../jms/provider/amqp/AmqpFixedProducer.java| 4 +- .../qpid/jms/provider/amqp/AmqpProvider.java| 41 ++-- .../apache/qpid/jms/transports/Transport.java | 25 ++-- .../jms/transports/netty/NettyTcpTransport.java | 20 -- .../jms/transports/netty/NettyWsTransport.java | 15 ++- .../transports/netty/NettyTcpTransportTest.java | 12 +++--- .../transports/netty/NettyWsTransportTest.java | 10 ++--- 7 files changed, 104 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/7750a1c2/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java index b2036fe..0f50b5c 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java @@ -166,7 +166,7 @@ public class AmqpFixedProducer extends AmqpProducer { // Put it on the wire and let it fail if the connection is broken, if it does // get written then continue on to determine when we should complete it. -if (provider.pumpToProtonTransport(request)) { +if (provider.pumpToProtonTransport(request, false)) { // For presettled messages we can just mark as successful and we are done, but // for any other message we still track it until the remote settles. If the send // was tagged as asynchronous we must mark the original request as complete but @@ -177,6 +177,8 @@ public class AmqpFixedProducer extends AmqpProducer { } else if (envelope.isSendAsync()) { send.getOriginalRequest().onSuccess(); } + +provider.getTransport().flush(); } } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/7750a1c2/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java index 7153bbe..890ebdb 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java @@ -116,6 +116,8 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP private static final AtomicInteger PROVIDER_SEQUENCE = new AtomicInteger(); private static final NoOpAsyncResult NOOP_REQUEST = new NoOpAsyncResult(); +private static final int DEFAULT_MAX_WRITE_BYTES_BEFORE_FLUSH = 128 * 1024; + private volatile ProviderListener listener; private volatile AmqpConnection connection; private AmqpSaslAuthenticator authenticator; @@ -131,6 +133,7 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP private int drainTimeout = 6; private long sessionOutoingWindow = -1; // Use proton default private int maxFrameSize = DEFAULT_MAX_FRAME_SIZE; +private int maxWriteBytesBeforeFlush = DEFAULT_MAX_WRITE_BYTES_BEFORE_FLUSH; private boolean allowNonSecureRedirects; @@ -695,8 +698,9 @@ public class AmqpProvider implements Provider, TransportListener , AmqpResourceP request.onSuccess(); pumpToProtonTransport(request); } else { -pumpToProtonTransport(request); +pumpToProtonTransport(request, false); request.onSuccess(); +transport.fl
qpid-proton-j git commit: PROTON-19 Optimization for the codec and transport hot paths
Repository: qpid-proton-j Updated Branches: refs/heads/master 2951b4051 -> 31f5fc97b PROTON-19 Optimization for the codec and transport hot paths Write a cachded encoded value for Accepted states as that does not change and can be easy syntheszied. Also write the descriptor codes directly in the fast path encoders since we know the type and value without needing to dip back into the generic encoder write methods. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/31f5fc97 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/31f5fc97 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/31f5fc97 Branch: refs/heads/master Commit: 31f5fc97bbf60a73ba913b7dc16851cf7e2a150b Parents: 2951b40 Author: Timothy Bish Authored: Thu Nov 1 15:13:16 2018 -0400 Committer: Timothy Bish Committed: Thu Nov 1 15:13:16 2018 -0400 -- .../codec/messaging/FastPathAcceptedType.java | 17 + .../messaging/FastPathAmqpSequenceType.java | 9 --- .../codec/messaging/FastPathAmqpValueType.java | 9 --- .../FastPathApplicationPropertiesType.java | 9 --- .../codec/messaging/FastPathDataType.java | 9 --- .../FastPathDeliveryAnnotationsType.java| 7 -- .../codec/messaging/FastPathFooterType.java | 7 -- .../codec/messaging/FastPathHeaderType.java | 15 +-- .../FastPathMessageAnnotationsType.java | 9 --- .../codec/messaging/FastPathPropertiesType.java | 15 +-- .../transport/FastPathDispositionType.java | 26 +++- .../codec/transport/FastPathFlowType.java | 12 + .../codec/transport/FastPathTransferType.java | 12 + 13 files changed, 102 insertions(+), 54 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/31f5fc97/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAcceptedType.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAcceptedType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAcceptedType.java index d9eb991..9e5e96d 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAcceptedType.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAcceptedType.java @@ -22,20 +22,29 @@ import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.Accepted; import org.apache.qpid.proton.codec.AMQPType; -import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.DecodeException; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; +import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; public class FastPathAcceptedType implements AMQPType, FastPathDescribedTypeConstructor { +private static final byte DESCRIPTOR_CODE = 0x24; + private static final Object[] DESCRIPTORS = { -UnsignedLong.valueOf(0x0024L), Symbol.valueOf("amqp:accepted:list"), +UnsignedLong.valueOf(DESCRIPTOR_CODE), Symbol.valueOf("amqp:accepted:list"), +}; + +private static final byte[] ACCEPTED_ENCODED_BYTES = new byte[] { +EncodingCodes.DESCRIBED_TYPE_INDICATOR, +EncodingCodes.SMALLULONG, +DESCRIPTOR_CODE, +EncodingCodes.LIST0 }; private final AcceptedType acceptedType; @@ -108,9 +117,7 @@ public class FastPathAcceptedType implements AMQPType, FastPathDescrib @Override public void write(Accepted accepted) { WritableBuffer buffer = getEncoder().getBuffer(); -buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR); -getEncoder().writeUnsignedLong(acceptedType.getDescriptor()); -buffer.put(EncodingCodes.LIST0); +buffer.put(ACCEPTED_ENCODED_BYTES, 0, ACCEPTED_ENCODED_BYTES.length); } public static void register(Decoder decoder, EncoderImpl encoder) { http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/31f5fc97/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAmqpSequenceType.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAmqpSequenceType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAmqpSequenceType.java index 611ec10..6a4ebd4 100644 ---
qpid-jms git commit: QPIDJMS-429 Make use of newer proton-j APIs for send and decode
Repository: qpid-jms Updated Branches: refs/heads/master 7b0aabfa9 -> aa424cab9 QPIDJMS-429 Make use of newer proton-j APIs for send and decode Use newer APIs to clean up some send code that handles dispositions and use new section type enums to simplify the message decoding portion of the codec. Also implement the writeable buffer ensure remaining method to better handle writes where the buffer needs to grow. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/aa424cab Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/aa424cab Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/aa424cab Branch: refs/heads/master Commit: aa424cab9b26c39b43fc6b45c53b1ec7e703ef42 Parents: 7b0aabf Author: Timothy Bish Authored: Mon Nov 12 11:31:34 2018 -0500 Committer: Timothy Bish Committed: Mon Nov 12 11:31:39 2018 -0500 -- .../jms/provider/amqp/AmqpFixedProducer.java| 61 +++--- .../jms/provider/amqp/message/AmqpCodec.java| 89 ++-- .../amqp/message/AmqpWritableBuffer.java| 5 ++ 3 files changed, 63 insertions(+), 92 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/aa424cab/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java index 4b2e5b1..c3010d2 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java @@ -34,13 +34,10 @@ import org.apache.qpid.jms.meta.JmsProducerInfo; import org.apache.qpid.jms.provider.AsyncResult; import org.apache.qpid.jms.provider.amqp.message.AmqpReadableBuffer; import org.apache.qpid.jms.util.IOExceptionSupport; -import org.apache.qpid.proton.amqp.messaging.Accepted; -import org.apache.qpid.proton.amqp.messaging.Modified; -import org.apache.qpid.proton.amqp.messaging.Outcome; import org.apache.qpid.proton.amqp.messaging.Rejected; -import org.apache.qpid.proton.amqp.messaging.Released; import org.apache.qpid.proton.amqp.transaction.TransactionalState; import org.apache.qpid.proton.amqp.transport.DeliveryState; +import org.apache.qpid.proton.amqp.transport.DeliveryState.DeliveryStateType; import org.apache.qpid.proton.amqp.transport.ErrorCondition; import org.apache.qpid.proton.amqp.transport.SenderSettleMode; import org.apache.qpid.proton.engine.Delivery; @@ -211,54 +208,58 @@ public class AmqpFixedProducer extends AmqpProducer { public void processDeliveryUpdates(AmqpProvider provider, Delivery delivery) throws IOException { DeliveryState state = delivery.getRemoteState(); if (state != null) { - InFlightSend send = (InFlightSend) delivery.getContext(); -if (state instanceof Accepted) { +if (state.getType() == DeliveryStateType.Accepted) { LOG.trace("Outcome of delivery was accepted: {}", delivery); send.onSuccess(); -super.processDeliveryUpdates(provider, delivery); -return; +} else { +applyDeliveryStateUpdate(send, delivery, state); } +} -Exception deliveryError = null; -Outcome outcome = null; +super.processDeliveryUpdates(provider, delivery); +} -if (state instanceof TransactionalState) { -LOG.trace("State of delivery is Transactional, retrieving outcome: {}", state); -outcome = ((TransactionalState) state).getOutcome(); -} else if (state instanceof Outcome) { -outcome = (Outcome) state; -} else { -LOG.warn("Message send updated with unsupported state: {}", state); -outcome = null; -} +private void applyDeliveryStateUpdate(InFlightSend send, Delivery delivery, DeliveryState state) { +Exception deliveryError = null; +if (state == null) { +return; +} -if (outcome instanceof Accepted) { +switch (state.getType()) { +case Transactional: +LOG.trace("State of delivery is Transactional, retrieving outcome: {}", state); +applyDeliveryStateUpdate(send, delivery, (DeliveryState) ((TransactionalState) state).getOutcome()); +break; +case Accepted: LOG.trace("Outcome of delivery was accepted: {}", delivery); send.onSuccess(); -} else if (outcome instanceof
[3/3] qpid-proton-j git commit: PROTON-1963 Improve performance of some fast path codec types
PROTON-1963 Improve performance of some fast path codec types For the fast path types that configure their map type encoding with a key type use a single lookup for the type to reduce overhead on each write. For the map based types do an in-place decode using the known key types and other structural expectations to improve decode performance. For the fast path data section type use the known structure of the type and avoid looking up encodings to improve performance of decodes. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/589504d7 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/589504d7 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/589504d7 Branch: refs/heads/master Commit: 589504d76e0a9567dcacca43695d4af414cd2e58 Parents: c8fd87e Author: Timothy Bish Authored: Tue Nov 13 16:12:32 2018 -0500 Committer: Timothy Bish Committed: Tue Nov 13 16:12:32 2018 -0500 -- .../FastPathApplicationPropertiesType.java | 105 -- .../codec/messaging/FastPathDataType.java | 31 +- .../FastPathDeliveryAnnotationsType.java| 106 +-- .../FastPathMessageAnnotationsType.java | 106 +-- 4 files changed, 327 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/589504d7/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathApplicationPropertiesType.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathApplicationPropertiesType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathApplicationPropertiesType.java index 08078f3..5ebb9ea 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathApplicationPropertiesType.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathApplicationPropertiesType.java @@ -17,17 +17,26 @@ package org.apache.qpid.proton.codec.messaging; import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.Map; +import org.apache.qpid.proton.ProtonException; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.ApplicationProperties; import org.apache.qpid.proton.codec.AMQPType; +import org.apache.qpid.proton.codec.ArrayType; +import org.apache.qpid.proton.codec.DecodeException; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.MapType; +import org.apache.qpid.proton.codec.PrimitiveTypeEncoding; +import org.apache.qpid.proton.codec.ReadableBuffer; +import org.apache.qpid.proton.codec.StringType; +import org.apache.qpid.proton.codec.TypeConstructor; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; @@ -35,15 +44,16 @@ public class FastPathApplicationPropertiesType implements AMQPType buffer.remaining()) { +throw new IllegalArgumentException("Map element count " + count + " is specified to be greater than the " + + "amount of data available ("+ buffer.remaining() + ")"); +} + +TypeConstructor valueConstructor = null; + +Map map = new LinkedHashMap<>(count); +for (int i = 0; i < count / 2; i++) { +String key = decoder.readString(null); +if (key == null) { +throw new DecodeException("String key in ApplicationProperties cannot be null"); +} + +boolean arrayType = false; +byte code = buffer.get(buffer.position()); +switch (code) +{ +case EncodingCodes.ARRAY8: +case EncodingCodes.ARRAY32: +arrayType = true; +} + +valueConstructor = findNextDecoder(decoder, buffer, valueConstructor); + +final Object value; + +if (arrayType) { +value = ((ArrayType.ArrayEncoding) valueConstructor).readValueArray(); +} else { +value = valueConstructor.readValue(); +} + +map.put(key, value); +} + +return new ApplicationProperties(map); } @Override @@ -99,17 +168,41 @@ public class FastPathApplicationPropertiesType implements AMQPType findNextDecoder(DecoderImpl decoder, ReadableBuffer buffer, TypeConstructor previousConstructor) { +if (previousConstructo
[1/3] qpid-proton-j git commit: PROTON-1963 Refactor string encoding size calculation
Repository: qpid-proton-j Updated Branches: refs/heads/master a9988721e -> 589504d76 PROTON-1963 Refactor string encoding size calculation Assume ASCII by default when calculating the string size in UTF8 to allow for inlining of this method in most cases and fallback to a multi-byte calculation only when non-ASCII chars are detected. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/391af064 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/391af064 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/391af064 Branch: refs/heads/master Commit: 391af064e2d50dfd29700f160166e86d8f4cba19 Parents: a998872 Author: Timothy Bish Authored: Tue Nov 13 14:53:13 2018 -0500 Committer: Timothy Bish Committed: Tue Nov 13 14:53:13 2018 -0500 -- .../apache/qpid/proton/codec/StringType.java| 32 +++- 1 file changed, 24 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/391af064/proton-j/src/main/java/org/apache/qpid/proton/codec/StringType.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/StringType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/StringType.java index 7687ca4..85448b3 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/StringType.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/StringType.java @@ -84,26 +84,42 @@ public class StringType extends AbstractPrimitiveType static int calculateUTF8Length(final String s) { -int len = s.length(); -final int length = len; -for (int i = 0; i < length; i++) +final int stringLength = s.length(); + +// ASCII Optimized length case +int utf8len = stringLength; +int processed = 0; +for (; processed < stringLength && s.charAt(processed) < 0x80; processed++) {} + +if (processed < stringLength) +{ +// Non-ASCII length remainder +utf8len = extendedCalculateUTF8Length(s, processed, stringLength, utf8len); +} + +return utf8len; +} + +static int extendedCalculateUTF8Length(final String s, int index, int length, int utf8len) { +for (; index < length; index++) { -int c = s.charAt(i); +int c = s.charAt(index); if ((c & 0xFF80) != 0) /* U+0080..*/ { -len++; +utf8len++; if(((c & 0xF800) != 0))/* U+0800..*/ { -len++; +utf8len++; // surrogate pairs should always combine to create a code point with a 4 octet representation if ((c & 0xD800) == 0xD800 && c < 0xDC00) { -i++; +index++; } } } } -return len; + +return utf8len; } @Override - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[2/3] qpid-proton-j git commit: PROTON-1963 Optimize hot path for encoder and decoder classes
PROTON-1963 Optimize hot path for encoder and decoder classes Optimize the hot paths in the encoder and decoder to deal directly with the primitive types and allow inlining of the normal encodings lookup path. Also cleans up some type encoding to use the read with defaults methods. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/c8fd87e0 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/c8fd87e0 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/c8fd87e0 Branch: refs/heads/master Commit: c8fd87e09177f49bd8f8ce7744d2f83af3510b3b Parents: 391af06 Author: Timothy Bish Authored: Tue Nov 13 15:26:50 2018 -0500 Committer: Timothy Bish Committed: Tue Nov 13 15:26:50 2018 -0500 -- .../apache/qpid/proton/codec/DecoderImpl.java | 163 ++- .../apache/qpid/proton/codec/EncoderImpl.java | 123 +++--- .../codec/messaging/FastPathHeaderType.java | 20 ++- .../codec/messaging/FastPathPropertiesType.java | 37 +++-- .../transport/FastPathDispositionType.java | 4 +- .../codec/transport/FastPathFlowType.java | 16 +- .../codec/transport/FastPathTransferType.java | 10 +- 7 files changed, 235 insertions(+), 138 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/c8fd87e0/proton-j/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java index 2d4989b..a85b0ff 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java @@ -20,6 +20,18 @@ */ package org.apache.qpid.proton.codec; +import java.lang.reflect.Array; +import java.nio.ByteBuffer; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + import org.apache.qpid.proton.ProtonException; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Decimal128; @@ -32,12 +44,6 @@ import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.UnsignedShort; -import java.lang.reflect.Array; -import java.nio.ByteBuffer; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.StandardCharsets; -import java.util.*; - public class DecoderImpl implements ByteBufferDecoder { private ReadableBuffer _buffer; @@ -90,11 +96,11 @@ public class DecoderImpl implements ByteBufferDecoder if (EncodingCodes.SMALLULONG == encoding || EncodingCodes.ULONG == encoding) { -descriptor = readUnsignedLong(); +descriptor = readUnsignedLong(null); } else if (EncodingCodes.SYM8 == encoding || EncodingCodes.SYM32 == encoding) { -descriptor = readSymbol(); +descriptor = readSymbol(null); } else { @@ -110,17 +116,19 @@ public class DecoderImpl implements ByteBufferDecoder } } -TypeConstructor nestedEncoding = readConstructor(); +TypeConstructor nestedEncoding = readConstructor(false); DescribedTypeConstructor dtc = _dynamicTypeConstructors.get(descriptor); if(dtc == null) { dtc = new DescribedTypeConstructor() { +@Override public DescribedType newInstance(final Object described) { return new UnknownDescribedType(descriptor, described); } +@Override public Class getTypeClass() { return UnknownDescribedType.class; @@ -136,11 +144,13 @@ public class DecoderImpl implements ByteBufferDecoder } } +@Override public void register(final Object descriptor, final FastPathDescribedTypeConstructor btc) { _fastPathTypeConstructors.put(descriptor, btc); } +@Override public void register(final Object descriptor, final DescribedTypeConstructor dtc) { // Allow external type constructors to replace the built-in instances. @@ -157,11 +167,13 @@ public class DecoderImpl implements ByteBufferDecoder } +@Override public Boolean readBoolean() { return readBoolean(null);
qpid-jms git commit: QPIDJMS-431 Refactor the FailoverProvider to improve performance
Repository: qpid-jms Updated Branches: refs/heads/master 30eb2d1b9 -> be560e69b QPIDJMS-431 Refactor the FailoverProvider to improve performance Refactor how the failover provider handles the workload passing though it and how it deals with connection failures to make its presence as transparent as possible to overall client performance. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/be560e69 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/be560e69 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/be560e69 Branch: refs/heads/master Commit: be560e69bf8d059166871c86f177abb6ae4fbbe6 Parents: 30eb2d1 Author: Timothy Bish Authored: Wed Nov 14 13:03:40 2018 -0500 Committer: Timothy Bish Committed: Wed Nov 14 13:03:40 2018 -0500 -- .../jms/provider/failover/FailoverProvider.java | 608 ++- .../failover/FailoverIntegrationTest.java | 22 +- .../provider/failover/FailoverProviderTest.java | 10 +- .../discovery/DiscoveryProviderFactory.java | 3 +- 4 files changed, 337 insertions(+), 306 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/be560e69/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java index 320beaf..dc35ba5 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java @@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.ReentrantReadWriteLock; import javax.jms.JMSException; import javax.jms.JMSSecurityException; @@ -75,6 +76,10 @@ public class FailoverProvider extends DefaultProviderListener implements Provide private static final Logger LOG = LoggerFactory.getLogger(FailoverProvider.class); +private static enum FailoverServerListAction { +ADD, REPLACE, IGNORE +} + public static final int UNLIMITED = -1; private static final int UNDEFINED = -1; @@ -95,8 +100,8 @@ public class FailoverProvider extends DefaultProviderListener implements Provide private final FailoverUriPool uris; private ScheduledFuture requestTimeoutTask; +private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private final ScheduledThreadPoolExecutor serializer; -private final ScheduledThreadPoolExecutor connectionHub; private final AtomicBoolean closed = new AtomicBoolean(); private final AtomicBoolean failed = new AtomicBoolean(); private final AtomicBoolean closingConnection = new AtomicBoolean(false); @@ -109,7 +114,7 @@ public class FailoverProvider extends DefaultProviderListener implements Provide // Current state of connection / reconnection private final ReconnectControls reconnectControl = new ReconnectControls(); private IOException failureCause; -private URI connectedURI; +private volatile URI connectedURI; private volatile JmsConnectionInfo connectionInfo; // Timeout values configured via JmsConnectionInfo @@ -129,28 +134,15 @@ public class FailoverProvider extends DefaultProviderListener implements Provide private FailoverServerListAction amqpOpenServerListAction = FailoverServerListAction.REPLACE; -public FailoverProvider(Map nestedOptions, ProviderFutureFactory futureFactory) { -this(null, nestedOptions, futureFactory); -} - -public FailoverProvider(List uris, ProviderFutureFactory futureFactory) { -this(uris, null, futureFactory); -} - public FailoverProvider(List uris, Map nestedOptions, ProviderFutureFactory futureFactory) { this.uris = new FailoverUriPool(uris, nestedOptions); this.futureFactory = futureFactory; -serializer = new ScheduledThreadPoolExecutor(1, new QpidJMSThreadFactory("FailoverProvider: serialization thread", true)); +// All Connection attempts happen in this executor thread as well as handling +// failed connection events and other maintenance work. +serializer = new ScheduledThreadPoolExecutor(1, new QpidJMSThreadFactory("FailoverProvider: async work thread", true)); serializer.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); serializer.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); - -// All Con
qpid-jms git commit: QPIDJMS-432 Update dependencies used in test and packaging
Repository: qpid-jms Updated Branches: refs/heads/master be560e69b -> a9f0ad020 QPIDJMS-432 Update dependencies used in test and packaging Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/a9f0ad02 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/a9f0ad02 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/a9f0ad02 Branch: refs/heads/master Commit: a9f0ad02085d4f4081a86222ba129c6a7d0fdcfe Parents: be560e6 Author: Timothy Bish Authored: Thu Nov 15 14:05:57 2018 -0500 Committer: Timothy Bish Committed: Thu Nov 15 14:05:57 2018 -0500 -- pom.xml | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a9f0ad02/pom.xml -- diff --git a/pom.xml b/pom.xml index 49144f7..65107f7 100644 --- a/pom.xml +++ b/pom.xml @@ -45,12 +45,12 @@ 1.0-alpha-2 -2.0.19.Final -5.15.6 +2.0.20.Final +5.15.7 4.12 1.0 9.4.12.v20180830 -2.22.0 +2.23.0 1.3 2.9.0 @@ -58,7 +58,7 @@ 2.6 2.10 2.5 -3.5.0 +3.5.1 3.0.2 0.8.2 2.21.0 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton-j git commit: PROTON-1967 Reduce garbage created in the transport
Repository: qpid-proton-j Updated Branches: refs/heads/master ba9617831 -> be6d9209e PROTON-1967 Reduce garbage created in the transport Used cached isntances of objects that are created and immediately discared after being sent into the frame writer. In order to fix tests the FrameBody types all need a copy method so that the events coming through the transport can be recorded for later analysis. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/be6d9209 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/be6d9209 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/be6d9209 Branch: refs/heads/master Commit: be6d9209e7e6e7311c1bdfae592469be29b918e3 Parents: ba96178 Author: Timothy Bish Authored: Mon Nov 19 15:51:42 2018 -0500 Committer: Timothy Bish Committed: Mon Nov 19 15:54:43 2018 -0500 -- .../org/apache/qpid/proton/amqp/Binary.java | 25 ++-- .../qpid/proton/amqp/transport/Attach.java | 50 +++- .../qpid/proton/amqp/transport/Begin.java | 40 -- .../qpid/proton/amqp/transport/Close.java | 19 ++- .../qpid/proton/amqp/transport/Detach.java | 24 +++- .../qpid/proton/amqp/transport/Disposition.java | 19 +++ .../qpid/proton/amqp/transport/EmptyFrame.java | 6 + .../apache/qpid/proton/amqp/transport/End.java | 19 ++- .../apache/qpid/proton/amqp/transport/Flow.java | 31 - .../qpid/proton/amqp/transport/FrameBody.java | 6 + .../apache/qpid/proton/amqp/transport/Open.java | 44 ++- .../qpid/proton/amqp/transport/Transfer.java| 25 +++- .../qpid/proton/engine/impl/TransportImpl.java | 126 +-- .../qpid/proton/amqp/transport/AttachTest.java | 65 ++ .../qpid/proton/amqp/transport/BeginTest.java | 58 + .../qpid/proton/amqp/transport/CloseTest.java | 36 ++ .../qpid/proton/amqp/transport/DetachTest.java | 45 +++ .../qpid/proton/amqp/transport/EndTest.java | 36 ++ .../qpid/proton/amqp/transport/FlowTest.java| 58 + .../qpid/proton/amqp/transport/OpenTest.java| 59 + .../proton/amqp/transport/TransferTest.java | 48 +++ .../qpid/proton/codec/TransferTypeTest.java | 2 +- .../proton/engine/impl/TransportImplTest.java | 2 +- 23 files changed, 746 insertions(+), 97 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/be6d9209/proton-j/src/main/java/org/apache/qpid/proton/amqp/Binary.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/amqp/Binary.java b/proton-j/src/main/java/org/apache/qpid/proton/amqp/Binary.java index ab1bfe5..f65a117 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/amqp/Binary.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/amqp/Binary.java @@ -27,7 +27,6 @@ import org.apache.qpid.proton.codec.ReadableBuffer; public final class Binary { - private final byte[] _data; private final int _offset; private final int _length; @@ -102,7 +101,6 @@ public final class Binary return true; } - public int getArrayOffset() { return _offset; @@ -118,11 +116,11 @@ public final class Binary return _length; } +@Override public String toString() { StringBuilder str = new StringBuilder(); - for (int i = 0; i < _length; i++) { byte c = _data[_offset + i]; @@ -138,12 +136,10 @@ public final class Binary } return str.toString(); - } public static Binary combine(final Collection binaries) { - if(binaries.size() == 1) { return binaries.iterator().next(); @@ -190,9 +186,11 @@ public final class Binary public static Binary create(ByteBuffer buffer) { -if( buffer == null ) +if (buffer == null) +{ return null; -if( buffer.isDirect() || buffer.isReadOnly() ) +} +if (buffer.isDirect() || buffer.isReadOnly()) { byte data[] = new byte [buffer.remaining()]; ByteBuffer dup = buffer.duplicate(); @@ -205,4 +203,17 @@ public final class Binary } } +public static Binary copy(Binary source) +{ +if (source == null) +{ +return null; +} +else +{ +byte[] data = new byte[source.getLength()]; +System.arraycopy(source.getArray(), source.getArrayOffset(), data, 0, source.getLength()); +return new Binary(data); +} +} } http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/be6d9209/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Attach.java ---
qpid-proton-j git commit: PROTON-1965 Add additional equality tests for buffer slices
Repository: qpid-proton-j Updated Branches: refs/heads/master be6d9209e -> 459b84d44 PROTON-1965 Add additional equality tests for buffer slices Adds tests for equality checks on sliced buffers with non-zero offsets. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/459b84d4 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/459b84d4 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/459b84d4 Branch: refs/heads/master Commit: 459b84d446160d75a5ca021ac349affcfe6e09d2 Parents: be6d920 Author: Timothy Bish Authored: Mon Nov 19 18:19:35 2018 -0500 Committer: Timothy Bish Committed: Mon Nov 19 18:19:35 2018 -0500 -- .../codec/CompositeReadableBufferTest.java | 88 +++- 1 file changed, 87 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/459b84d4/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java -- diff --git a/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java b/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java index 1e8e731..5325f17 100644 --- a/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java +++ b/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java @@ -16,7 +16,15 @@ */ package org.apache.qpid.proton.codec; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; @@ -3610,6 +3618,84 @@ public class CompositeReadableBufferTest { assertEquals(3, buffer2.position()); } +@Test +public void testEqualsWhenContentRemainingWithDifferentlyPositionedSlicesSame() throws CharacterCodingException { + doEqualsWhenContentRemainingWithDifferentlyPositionedSlicesSameTestImpl(false); +} + +@Test +public void testEqualsWhenContentRemainingWithDifferentlyPositionedSlicesSameMultipleArrays() throws CharacterCodingException { + doEqualsWhenContentRemainingWithDifferentlyPositionedSlicesSameTestImpl(true); +} + +private void doEqualsWhenContentRemainingWithDifferentlyPositionedSlicesSameTestImpl(boolean multipleArrays) { +CompositeReadableBuffer buffer1 = new CompositeReadableBuffer(); +CompositeReadableBuffer buffer2 = new CompositeReadableBuffer(); + +byte[] data1 = new byte[] {-1, -1, 0, 1, 2, 3, 4, 5}; +byte[] data2 = new byte[] {-1, -1, -1, 0, 1, 2, 3, 4, 5}; + +buffer1.append(data1); +buffer1.position(2); + +buffer2.append(data2); +buffer2.position(3); + +if (multipleArrays) { +byte[] data3 = new byte[] { 5, 4, 3, 2, 1 }; +buffer1.append(data3); +buffer2.append(data3); +} + +buffer1 = buffer1.slice(); +buffer2 = buffer2.slice(); + +assertEquals(buffer1, buffer2); +assertEquals(buffer2, buffer1); + +assertEquals(0, buffer1.position()); +assertEquals(0, buffer2.position()); +} + +@Test +public void testEqualsWhenContentRemainingWithDifferentlyPositionedSlicesNotSame() throws CharacterCodingException { + doEqualsWhenContentRemainingWithDifferentlyPositionedSlicesNotSameTestImpl(false); +} + +@Test +public void testEqualsWhenContentRemainingWithDifferentlyPositionedSlicesNotSameMultipleArrays() throws CharacterCodingException { + doEqualsWhenContentRemainingWithDifferentlyPositionedSlicesNotSameTestImpl(true); +} + +private void doEqualsWhenContentRemainingWithDifferentlyPositionedSlicesNotSameTestImpl(boolean multipleArrays) { +CompositeReadableBuffer buffer1 = new CompositeReadableBuffer(); +CompositeReadableBuffer buffer2 = new CompositeReadableBuffer(); + +byte[] data1 = new byte[] {-1, -1, 0, 1, 2, 3, 4, 5}; +byte[] data2 = new byte[] {-1, -1, -1, 0, 1, 2, 3, 4, -1}; + +buffer1.append(data1); +buffer1.position(2); + +buffer2.append(data2); +buffer2.position(3); + +if (multipleArrays) { +byte[] data3 = new byte[] { 5, 4, 3, 2, 1 }; +buffer1.append(data3); +buffer2.append(data3); +} + +buffer1 = buffer1.slice()
qpid-jms git commit: QPIDJMS-434 Safe iteration over consumer that can close during
Repository: qpid-jms Updated Branches: refs/heads/master a9f0ad020 -> 2186300e8 QPIDJMS-434 Safe iteration over consumer that can close during Ensure that we safely iterate over the consumers when processing a client acknowledge to ensure that deferred closures don't cause a ConcurrentModificationException which will error out the acknowledge operation. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/2186300e Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/2186300e Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/2186300e Branch: refs/heads/master Commit: 2186300e879e1dc235e67d7b197c55b46618dc2b Parents: a9f0ad0 Author: Timothy Bish Authored: Tue Nov 20 17:06:05 2018 -0500 Committer: Timothy Bish Committed: Tue Nov 20 17:06:05 2018 -0500 -- .../qpid/jms/provider/amqp/AmqpSession.java | 5 +- .../integration/ConsumerIntegrationTest.java| 80 +++- 2 files changed, 83 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/2186300e/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java index 83f12f7..c71a485 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java @@ -71,7 +71,10 @@ public class AmqpSession extends AmqpAbstractResource i * controls the acknowledgement that is applied to each message. */ public void acknowledge(final ACK_TYPE ackType) { -for (AmqpConsumer consumer : consumers.values()) { +// A consumer whose close was deferred will be closed and removed from the consumers +// map so we must copy the entries to safely traverse the collection during this operation. +List consumers = new ArrayList<>(this.consumers.values()); +for (AmqpConsumer consumer : consumers) { consumer.acknowledge(ackType); } } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/2186300e/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java -- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java index fbc0e41..7be79eb 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java @@ -1590,7 +1590,85 @@ public class ConsumerIntegrationTest extends QpidJmsTestCase { } @Test(timeout=2) -public void testConsumerWithDeferredCloseActsAsClosed() throws Exception { +public void testCloseConsumersWithDeferredAckHandledLaterWhenlastConsumedMessageIsAcked() throws Exception { +try (TestAmqpPeer testPeer = new TestAmqpPeer();) { +final int DEFAULT_PREFETCH = 10; + +// Set to fixed known value to reduce breakage if defaults are changed. +Connection connection = testFixture.establishConnecton(testPeer, "jms.prefetchPolicy.all=" + DEFAULT_PREFETCH); +connection.start(); + +testPeer.expectBegin(); + +Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); +Queue queue = session.createQueue(getTestName()); + +testPeer.expectReceiverAttach(); +testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, new AmqpValueDescribedType("content-for-consumer-1"), +1, false, false, Matchers.equalTo(UnsignedInteger.valueOf(DEFAULT_PREFETCH)), 1, true); + +testPeer.expectReceiverAttach(); +testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, new AmqpValueDescribedType("content-for-consumer-2"), +1, false, false, Matchers.equalTo(UnsignedInteger.valueOf(DEFAULT_PREFETCH)), 2, true); + +final CountDownLatch expected = new CountDownLatch(2); +((JmsConnection) connection).addConnectionListener(new JmsDefaultConnectionListener() { +@Override +public void onInboundMessage(JmsInboundMessageDispatch envelope) { +expected.countDown(); +} +}); + +// These are our two consumers, the first gets a message and abandons it, the
qpid-proton-j git commit: NO-JIRA add a benchmark for CompositeReadableBuffer string decode
Repository: qpid-proton-j Updated Branches: refs/heads/master 57774d063 -> f62ec61c5 NO-JIRA add a benchmark for CompositeReadableBuffer string decode Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/f62ec61c Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/f62ec61c Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/f62ec61c Branch: refs/heads/master Commit: f62ec61c5294e8515fec682153c16bfc29299d02 Parents: 57774d0 Author: Timothy Bish Authored: Mon Dec 3 15:04:27 2018 -0500 Committer: Timothy Bish Committed: Mon Dec 3 15:04:27 2018 -0500 -- ...siteReadableBufferStringDecodeBenchmark.java | 108 +++ 1 file changed, 108 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/f62ec61c/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java -- diff --git a/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java b/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java new file mode 100644 index 000..8d8ea96 --- /dev/null +++ b/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.qpid.proton.codec; + +import java.nio.charset.CharacterCodingException; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.concurrent.TimeUnit; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; +import org.openjdk.jmh.profile.GCProfiler; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +@State(Scope.Benchmark) +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) +public class CompositeReadableBufferStringDecodeBenchmark { + +private static final String PAYLOAD = + "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" ++ "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" ++ "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" ++ "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" ++ "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"; + +private static final String PAYLOAD_CHUNK = + "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"; + +private final CharsetDecoder charsetDecoder = StandardCharsets.UTF_8.newDecoder(); + +private CompositeReadableBuffer singleArrayString; +private CompositeReadableBuffer splitArrayString; + +private Blackhole blackhole; + +@Setup +public void init(Blackhole blackhole) { +this.blackhole = blackhole; + +byte[] payload = PAYLOAD.getBytes(StandardCharsets.UTF_8); +singleArrayString = new CompositeReadableBuffer(); +singleArrayString.append(payload); + +splitArrayString = new CompositeReadableBuffer(); + +byte[] payloadChunk = P
[2/2] qpid-proton-j git commit: PROTON-1980 Optimize the CompositeReadableBuffer hashCode method
PROTON-1980 Optimize the CompositeReadableBuffer hashCode method Optimize hashCode to better deal with multiple array contents when producing the hashCode. Adds additional JMH tests to cover this area. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/31a0b35f Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/31a0b35f Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/31a0b35f Branch: refs/heads/master Commit: 31a0b35f05794fcbbcf906bc6b921148ac65a27a Parents: 068f4d0 Author: Timothy Bish Authored: Fri Dec 7 14:41:16 2018 -0500 Committer: Timothy Bish Committed: Fri Dec 7 14:41:16 2018 -0500 -- .../proton/codec/CompositeReadableBuffer.java | 51 +++-- .../codec/CompositeReadableBufferTest.java | 37 .../codec/CompositeReadableBufferBenchmark.java | 207 ++- .../CompositeReadableBufferEqualsBenchmark.java | 108 ++ ...siteReadableBufferStringDecodeBenchmark.java | 110 -- 5 files changed, 337 insertions(+), 176 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/31a0b35f/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java index 5310faf..3aec96c 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java @@ -702,11 +702,11 @@ public class CompositeReadableBuffer implements ReadableBuffer { } private void validateBuffer(ReadableBuffer buffer) { -if(buffer == null) { +if (buffer == null) { throw new IllegalArgumentException("A non-null buffer must be provided"); } -if(!buffer.hasRemaining()) { +if (!buffer.hasRemaining()) { throw new IllegalArgumentException("Buffer has no remaining content to append"); } } @@ -739,8 +739,7 @@ public class CompositeReadableBuffer implements ReadableBuffer { do { int bufferRemaining = buffer.remaining(); int arrayRemaining = buffer.currentArray.length - buffer.currentOffset; -if (buffer.currentOffset > 0 || bufferRemaining < arrayRemaining) -{ +if (buffer.currentOffset > 0 || bufferRemaining < arrayRemaining) { int length = Math.min(arrayRemaining, bufferRemaining); chunk = new byte[length]; System.arraycopy(buffer.currentArray, buffer.currentOffset, chunk, 0, length); @@ -783,7 +782,7 @@ public class CompositeReadableBuffer implements ReadableBuffer { validateAppendable(); validateBuffer(buffer); -if(buffer.hasArray()) { +if (buffer.hasArray()) { byte[] chunk = buffer.array(); int bufferRemaining = buffer.remaining(); @@ -809,16 +808,44 @@ public class CompositeReadableBuffer implements ReadableBuffer { @Override public int hashCode() { int hash = 1; +int remaining = remaining(); -if (currentArrayIndex < 0) { -int span = limit() - position(); -while (span > 0) { -hash = 31 * hash + currentArray[currentOffset + --span]; +if (currentArrayIndex < 0 || remaining <= currentArray.length - currentOffset) { +while (remaining > 0) { +hash = 31 * hash + currentArray[currentOffset + --remaining]; } } else { -final int currentPos = position(); -for (int i = limit() - 1; i >= currentPos; i--) { -hash = 31 * hash + (int)get(i); +hash = hashCodeFromComponents(); +} + +return hash; +} + +private int hashCodeFromComponents() { +int hash = 1; +byte[] array = currentArray; +int arrayOffset = currentOffset; +int arraysIndex = currentArrayIndex; + +// Run to the the array and offset where we want to start the hash from +final int remaining = remaining(); +for (int moveBy = remaining; moveBy > 0; ) { +if (moveBy <= array.length - arrayOffset) { +arrayOffset += moveBy; +break; +} else { +moveBy -= array.length - arrayOffset; +array = contents.get(++arraysIndex); +arrayOffset = 0; +} +} + +// Now run backwards through the arrays to match what ByteBuffer would produce +for (int m
[1/2] qpid-proton-j git commit: NO-JIRA Rewind the buffer for each test
Repository: qpid-proton-j Updated Branches: refs/heads/master f62ec61c5 -> 31a0b35f0 NO-JIRA Rewind the buffer for each test Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/068f4d01 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/068f4d01 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/068f4d01 Branch: refs/heads/master Commit: 068f4d01c076c50cfeca61e6fcd7340e84a9dfd4 Parents: f62ec61 Author: Timothy Bish Authored: Mon Dec 3 18:12:52 2018 -0500 Committer: Timothy Bish Committed: Mon Dec 3 18:12:52 2018 -0500 -- .../codec/CompositeReadableBufferStringDecodeBenchmark.java| 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/068f4d01/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java -- diff --git a/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java b/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java index 8d8ea96..ac1cbb0 100644 --- a/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java +++ b/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBufferStringDecodeBenchmark.java @@ -80,14 +80,16 @@ public class CompositeReadableBufferStringDecodeBenchmark { @Benchmark public void decodeSingleArray() throws CharacterCodingException { -this.charsetDecoder.reset(); +charsetDecoder.reset(); blackhole.consume(singleArrayString.readString(charsetDecoder)); +singleArrayString.rewind(); } @Benchmark public void decodeMultiArray() throws CharacterCodingException { -this.charsetDecoder.reset(); +charsetDecoder.reset(); blackhole.consume(splitArrayString.readString(charsetDecoder)); +singleArrayString.rewind(); } public static void main(String[] args) throws RunnerException { - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-jms git commit: QPIDJMS-438 Ensure that closed sessions are removed from tracking
Repository: qpid-jms Updated Branches: refs/heads/master 2da24883d -> 26ec26863 QPIDJMS-438 Ensure that closed sessions are removed from tracking When a session is remotely closed it can be left in the Connection tracking map which can lead to large leaks of remotely closed sessions over time. Ensure it is removed on shutdown calls. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/26ec2686 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/26ec2686 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/26ec2686 Branch: refs/heads/master Commit: 26ec26863410ddf11097054987764b93567a4663 Parents: 2da2488 Author: Timothy Bish Authored: Wed Dec 12 12:32:17 2018 -0500 Committer: Timothy Bish Committed: Wed Dec 12 12:32:56 2018 -0500 -- .../java/org/apache/qpid/jms/JmsSession.java| 49 +++- 1 file changed, 26 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/26ec2686/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java -- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java index 0970a6d..ea70544 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java @@ -305,7 +305,6 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe connection.destroyResource(sessionInfo); } catch (JmsConnectionFailedException jmsex) { } -connection.removeSession(sessionInfo); if (interrupted) { Thread.currentThread().interrupt(); } @@ -328,34 +327,38 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe protected void shutdown(Throwable cause) throws JMSException { if (closed.compareAndSet(false, true)) { -sessionInfo.setState(ResourceState.CLOSED); -setFailureCause(cause); -stop(); +try { +sessionInfo.setState(ResourceState.CLOSED); +setFailureCause(cause); +stop(); -for (JmsMessageConsumer consumer : new ArrayList(this.consumers.values())) { -consumer.shutdown(cause); -} +for (JmsMessageConsumer consumer : new ArrayList(this.consumers.values())) { +consumer.shutdown(cause); +} -for (JmsMessageProducer producer : new ArrayList(this.producers.values())) { -producer.shutdown(cause); -} +for (JmsMessageProducer producer : new ArrayList(this.producers.values())) { +producer.shutdown(cause); +} -transactionContext.shutdown(); +transactionContext.shutdown(); -// Ensure that no asynchronous completion sends remain blocked after close. -synchronized (sessionInfo) { -if (cause == null) { -cause = new JMSException("Session closed remotely before message transfer result was notified"); -} +// Ensure that no asynchronous completion sends remain blocked after close. +synchronized (sessionInfo) { +if (cause == null) { +cause = new JMSException("Session closed remotely before message transfer result was notified"); +} -getCompletionExecutor().execute(new FailOrCompleteAsyncCompletionsTask(JmsExceptionSupport.create(cause))); -getCompletionExecutor().shutdown(); -} +getCompletionExecutor().execute(new FailOrCompleteAsyncCompletionsTask(JmsExceptionSupport.create(cause))); +getCompletionExecutor().shutdown(); +} -try { - getCompletionExecutor().awaitTermination(connection.getCloseTimeout(), TimeUnit.MILLISECONDS); -} catch (InterruptedException e) { -LOG.trace("Session close awaiting send completions was interrupted"); +try { + getCompletionExecutor().awaitTermination(connection.getCloseTimeout(), TimeUnit.MILLISECONDS); +} catch (InterruptedException e) { +LOG.trace("Session close awaiting send completions was interrupted"); +} +} finally { +connection.removeSession(sessionInfo); } } } - To unsubs
[qpid-jms] branch master updated: QPIDJMS-440 Update Netty to 4.1.32.Final
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 048102b QPIDJMS-440 Update Netty to 4.1.32.Final 048102b is described below commit 048102b1a7b7f5878178f99c80303271d3c4be18 Author: Timothy Bish AuthorDate: Fri Dec 14 12:25:41 2018 -0500 QPIDJMS-440 Update Netty to 4.1.32.Final --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 460358a..30cb8e3 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ 0.31.0 -4.1.31.Final +4.1.32.Final 1.7.25 1.0-alpha-2 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-445 Update Netty libraries to latest
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 59f62b1 QPIDJMS-445 Update Netty libraries to latest 59f62b1 is described below commit 59f62b111687072fad3302fb4c6f91a389b4c0e6 Author: Timothy Bish AuthorDate: Fri Mar 8 11:36:05 2019 -0500 QPIDJMS-445 Update Netty libraries to latest Update to Netty 4.1.34.Final and Netty nateives 2.22.0.Final Updates Mockito to latest 2.25.0 release --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 37c4aa7..917c4e3 100644 --- a/pom.xml +++ b/pom.xml @@ -40,17 +40,17 @@ 0.31.0 -4.1.32.Final +4.1.34.Final 1.7.25 1.0-alpha-2 -2.0.20.Final +2.0.22.Final 5.15.8 4.12 1.0 9.4.12.v20180830 -2.23.4 +2.25.0 1.3 2.9.0 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-proton-j] branch master updated: PROTON-2037: Ensure array offset is moved forward correctly
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git The following commit(s) were added to refs/heads/master by this push: new 111a8b1 PROTON-2037: Ensure array offset is moved forward correctly new 1442df3 This closes #32 111a8b1 is described below commit 111a8b12579f40697c8791c193c962db5c69c029 Author: Ulf Lilleengen AuthorDate: Mon Apr 29 15:09:40 2019 +0200 PROTON-2037: Ensure array offset is moved forward correctly * Add test case exposing the sequence of events causing an ArrayIndexOutOfBoundsException * Fix offset movement for getLong and getInt methods * Add checking of offset to get(int index) --- .../qpid/proton/codec/CompositeReadableBuffer.java | 2 ++ .../proton/codec/CompositeReadableBufferTest.java | 25 ++ 2 files changed, 27 insertions(+) diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java index 3aec96c..abbb40b 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java @@ -213,6 +213,7 @@ public class CompositeReadableBuffer implements ReadableBuffer { (int)(currentArray[currentOffset++] & 0xFF) << 16 | (int)(currentArray[currentOffset++] & 0xFF) << 8 | (int)(currentArray[currentOffset++] & 0xFF) << 0; +maybeMoveToNextArray(); } else { for (int i = INT_BYTES - 1; i >= 0; --i) { result |= (int)(currentArray[currentOffset++] & 0xFF) << (i * Byte.SIZE); @@ -242,6 +243,7 @@ public class CompositeReadableBuffer implements ReadableBuffer { (long)(currentArray[currentOffset++] & 0xFF) << 16 | (long)(currentArray[currentOffset++] & 0xFF) << 8 | (long)(currentArray[currentOffset++] & 0xFF) << 0; +maybeMoveToNextArray(); } else { for (int i = LONG_BYTES - 1; i >= 0; --i) { result |= (long)(currentArray[currentOffset++] & 0xFF) << (i * Byte.SIZE); diff --git a/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java b/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java index 28d5d17..9dc5c1b 100644 --- a/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java +++ b/proton-j/src/test/java/org/apache/qpid/proton/codec/CompositeReadableBufferTest.java @@ -3027,6 +3027,31 @@ public class CompositeReadableBufferTest { } @Test +public void testPositionMovedOnArrayBounderies() { +CompositeReadableBuffer buffer = new CompositeReadableBuffer(); + +buffer.append(new byte[] { 1, 2, 3, 4 }); +buffer.append(new byte[] { 5, 6 }); +buffer.append(new byte[] { 7, 8, 9, 10, 11, 12, 13, 14 }); +buffer.append(new byte[] { 15 }); + +buffer.getInt(); +assertEquals(5, buffer.get(4)); +buffer.get(); +buffer.get(); +buffer.getLong(); +assertEquals(15, buffer.get(14)); +assertEquals(15, buffer.get(14)); + +try { +buffer.get(15); +} catch (IndexOutOfBoundsException aiobe) {} + +buffer.position(4); +assertEquals(5, buffer.get(4)); +} + +@Test public void testSliceRefusesAppends() { CompositeReadableBuffer buffer = new CompositeReadableBuffer(); buffer.append(new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-proton-j] branch master updated: PROTON-1508 Fix incorrect size value returned from Received type
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git The following commit(s) were added to refs/heads/master by this push: new c63732a PROTON-1508 Fix incorrect size value returned from Received type c63732a is described below commit c63732a89586dbdb52c4b46e22b9c565699f10ad Author: Timothy Bish AuthorDate: Mon Apr 29 15:13:10 2019 -0400 PROTON-1508 Fix incorrect size value returned from Received type --- .../qpid/proton/codec/messaging/ReceivedType.java | 29 -- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java index d10fed6..be4653a 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -19,12 +18,11 @@ * under the License. * */ - - package org.apache.qpid.proton.codec.messaging; import java.util.AbstractList; import java.util.List; + import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; @@ -34,8 +32,7 @@ import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; - -public final class ReceivedType extends AbstractDescribedType implements DescribedTypeConstructor +public final class ReceivedType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { @@ -49,6 +46,7 @@ public final class ReceivedType extends AbstractDescribedType imp super(encoder); } +@Override public UnsignedLong getDescriptor() { return DESCRIPTOR; @@ -60,7 +58,6 @@ public final class ReceivedType extends AbstractDescribedType imp return new ReceivedWrapper(val); } - private static final class ReceivedWrapper extends AbstractList { private final Received _impl; @@ -70,9 +67,9 @@ public final class ReceivedType extends AbstractDescribedType imp _impl = impl; } +@Override public Object get(final int index) { - switch(index) { case 0: @@ -82,46 +79,43 @@ public final class ReceivedType extends AbstractDescribedType imp } throw new IllegalStateException("Unknown index " + index); - } +@Override public int size() { return _impl.getSectionOffset() != null ? 2 - : _impl.getSectionOffset() != null + : _impl.getSectionNumber() != null ? 1 : 0; - } } +@Override public Received newInstance(Object described) { -List l = (List) described; +List l = (List) described; Received o = new Received(); - switch(2 - l.size()) { - case 0: -o.setSectionOffset( (UnsignedLong) l.get( 1 ) ); +o.setSectionOffset((UnsignedLong) l.get( 1 )); case 1: -o.setSectionNumber( (UnsignedInteger) l.get( 0 ) ); +o.setSectionNumber((UnsignedInteger) l.get( 0 )); } - return o; } +@Override public Class getTypeClass() { return Received.class; } - public static void register(Decoder decoder, EncoderImpl encoder) { ReceivedType type = new ReceivedType(encoder); @@ -132,4 +126,3 @@ public final class ReceivedType extends AbstractDescribedType imp encoder.register(type); } } - \ No newline at end of file - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-457 Ensure that on send failure the message state is reset
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 16988f3 QPIDJMS-457 Ensure that on send failure the message state is reset 16988f3 is described below commit 16988f3307588fbdfb73558bf469ad0128997190 Author: Timothy Bish AuthorDate: Mon May 13 14:21:22 2019 -0400 QPIDJMS-457 Ensure that on send failure the message state is reset On sync send failure ensure that message state resets to writable so that the message can be resent if desired. --- .../main/java/org/apache/qpid/jms/JmsSession.java | 8 ++- .../jms/integration/ProducerIntegrationTest.java | 59 ++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java index ea70544..99f1392 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java @@ -813,6 +813,9 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe private void send(JmsMessageProducer producer, JmsDestination destination, Message original, int deliveryMode, int priority, long timeToLive, boolean disableMsgId, boolean disableTimestamp, long deliveryDelay, CompletionListener listener) throws JMSException { sendLock.lock(); + +JmsMessage outbound = null; + try { original.setJMSDeliveryMode(deliveryMode); original.setJMSPriority(priority); @@ -843,7 +846,6 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe messageId = producer.getMessageIDBuilder().createMessageID(producer.getProducerId().toString(), messageSequence); } -JmsMessage outbound = null; if (isJmsMessage) { outbound = (JmsMessage) original; } else { @@ -929,6 +931,10 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe } else { transactionContext.send(connection, envelope, null); } +} catch (JMSException jmsEx) { +// Ensure that on failure case the message is returned to usable state for another send attempt. +outbound.onSendComplete(); +throw jmsEx; } finally { sendLock.unlock(); } diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java index 4bebb03..5207caf 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java @@ -46,6 +46,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import javax.jms.BytesMessage; @@ -3119,4 +3120,62 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { completed.countDown(); } } + +@Test(timeout = 2) +public void testFailedSendToOfflineConnectionMessageCanBeResentToNewConnection() throws Exception { +try (TestAmqpPeer originalPeer = new TestAmqpPeer(); + TestAmqpPeer finalPeer = new TestAmqpPeer();) { + +final AtomicBoolean exceptionListenerFired = new AtomicBoolean(); +final String text = "my-message-body-text"; + +//- Initial connection expectations and failure instructions +JmsConnection connection = (JmsConnection) testFixture.establishConnecton(originalPeer); +connection.setExceptionListener(new ExceptionListener() { +@Override +public void onException(JMSException exception) { +LOG.trace("JMS ExceptionListener: ", exception); +exceptionListenerFired.set(true); +} +}); + +originalPeer.expectBegin(); +originalPeer.expectSenderAttach(); +originalPeer.dropAfterLastHandler(); + +Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); +TextMessage message = session.createTextMessage(text); +Queue queue = session.createQueue("myQueue"); + +// initial producer which will be sent to after connection fails +MessageProducer producer = session.createProducer(queue); + +// Await connection drop and then send t
[qpid-jms] branch master updated: NO-JIRA make use of the ActiveMQ test repeat rule for repeated tests
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 30f5132 NO-JIRA make use of the ActiveMQ test repeat rule for repeated tests 30f5132 is described below commit 30f5132b2c28ff29023bdd00153c34385a3e2e31 Author: Timothy Bish AuthorDate: Tue May 14 12:16:23 2019 -0400 NO-JIRA make use of the ActiveMQ test repeat rule for repeated tests Use a test repeat rule which will setup and teardown properly between each test run instead of running in a tight loop to give broker setup and teardown a proper cycle on each iteration. --- .../qpid/jms/JmsConnectionCloseVariationsTest.java | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionCloseVariationsTest.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionCloseVariationsTest.java index 2196186..653635d 100644 --- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionCloseVariationsTest.java +++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionCloseVariationsTest.java @@ -18,12 +18,16 @@ package org.apache.qpid.jms; import javax.jms.Connection; +import org.apache.activemq.junit.ActiveMQTestRunner; +import org.apache.activemq.junit.Repeat; import org.apache.qpid.jms.support.AmqpTestSupport; import org.junit.Test; +import org.junit.runner.RunWith; /** * A test case for Connection close called under different circumstances. */ +@RunWith(ActiveMQTestRunner.class) public class JmsConnectionCloseVariationsTest extends AmqpTestSupport { @Test(timeout=6) @@ -31,12 +35,10 @@ public class JmsConnectionCloseVariationsTest extends AmqpTestSupport { doTestConnectionClosedAfterBrokerStopped(); } +@Repeat(repetitions = 25) @Test(timeout=9) public void testCloseAfterBrokerStoppedRepeated() throws Exception { -for (int i = 0; i < 50; ++i) { -doTestConnectionClosedAfterBrokerStopped(); -restartPrimaryBroker(); -} +doTestConnectionClosedAfterBrokerStopped(); } private void doTestConnectionClosedAfterBrokerStopped() throws Exception { @@ -51,12 +53,10 @@ public class JmsConnectionCloseVariationsTest extends AmqpTestSupport { doTestConnectionClosedBeforeBrokerStopped(); } +@Repeat(repetitions = 25) @Test(timeout=9) public void testCloseBeforeBrokerStoppedRepeated() throws Exception { -for (int i = 0; i < 50; ++i) { -doTestConnectionClosedBeforeBrokerStopped(); -restartPrimaryBroker(); -} +doTestConnectionClosedBeforeBrokerStopped(); } private void doTestConnectionClosedBeforeBrokerStopped() throws Exception { - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-457 Use connection listener to ensure wait until dropped
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new c18f6ff QPIDJMS-457 Use connection listener to ensure wait until dropped c18f6ff is described below commit c18f6ff3fb857917d4f19dcd39a82ae39f999cf6 Author: Timothy Bish AuthorDate: Tue May 21 11:59:22 2019 -0400 QPIDJMS-457 Use connection listener to ensure wait until dropped Use a listener on the connection to wait until dropped before proceeding with the send / reconnect / send again phase of the test. --- .../qpid/jms/integration/ProducerIntegrationTest.java | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java index 3040022..3c36512 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java @@ -46,7 +46,6 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import javax.jms.BytesMessage; @@ -3126,16 +3125,16 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { try (TestAmqpPeer originalPeer = new TestAmqpPeer(); TestAmqpPeer finalPeer = new TestAmqpPeer();) { -final AtomicBoolean exceptionListenerFired = new AtomicBoolean(); +final CountDownLatch connectionFailed = new CountDownLatch(1); final String text = "my-message-body-text"; //- Initial connection expectations and failure instructions JmsConnection connection = (JmsConnection) testFixture.establishConnecton(originalPeer); -connection.setExceptionListener(new ExceptionListener() { +connection.addConnectionListener(new JmsDefaultConnectionListener() { + @Override -public void onException(JMSException exception) { -LOG.trace("JMS ExceptionListener: ", exception); -exceptionListenerFired.set(true); +public void onConnectionFailure(Throwable error) { +connectionFailed.countDown(); } }); @@ -3150,8 +3149,7 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { // initial producer which will be sent to after connection fails MessageProducer producer = session.createProducer(queue); -// Await connection drop and then send to trigger failure from closed connection. -assertFalse("The ExceptionListener should not have been alerted", exceptionListenerFired.get()); +assertTrue("Connection should have been remotely closed", connectionFailed.await(10, TimeUnit.SECONDS)); try { producer.send(message); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] 01/01: QPIDJMS-461 Optimize the default message ID builder
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch QPIDJMS-461 in repository https://gitbox.apache.org/repos/asf/qpid-jms.git commit b2300cbfbcd00eb990c82e5be1735df9f6ba89c5 Author: Timothy Bish AuthorDate: Mon Jun 17 16:15:22 2019 -0400 QPIDJMS-461 Optimize the default message ID builder Change the builtin Message ID builder to create a builder per producer and optimize the string handling used to create the Message ID from the producer id and sequence number. --- .../qpid/jms/message/JmsMessageIDBuilder.java | 26 ++ .../qpid/jms/policy/JmsDefaultMessageIDPolicy.java | 16 - 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java index 319506b..f8a32cb 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java @@ -30,15 +30,19 @@ public interface JmsMessageIDBuilder { DEFAULT { @Override public JmsMessageIDBuilder createBuilder() { + return new JmsMessageIDBuilder() { +private final StringBuilder builder = new StringBuilder(); + @Override public Object createMessageID(String producerId, long messageSequence) { -String messageId = producerId + "-" + messageSequence; -if (!AmqpMessageIdHelper.hasMessageIdPrefix(messageId)) { -messageId = AmqpMessageIdHelper.JMS_ID_PREFIX + messageId; +builder.setLength(0); +if (!AmqpMessageIdHelper.hasMessageIdPrefix(producerId)) { +builder.append(AmqpMessageIdHelper.JMS_ID_PREFIX); } -return messageId; + builder.append(producerId).append("-").append(messageSequence); +return builder.toString(); } @Override @@ -115,6 +119,20 @@ public interface JmsMessageIDBuilder { public static JmsMessageIDBuilder create(String value) { return valueOf(value.toUpperCase(Locale.ENGLISH)).createBuilder(); } + +/** + * Validates the value given maps to the built in message ID builders and + * return the builder enumeration that it maps to which can later be used + * to create builders of that type. + * + * @param value + * The name of one of the built in message ID builders. + * + * @return the enumeration value that maps to the built in builder. + */ +public static BUILTIN validate(String value) { +return valueOf(value.toUpperCase(Locale.ENGLISH)); +} } /** diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/policy/JmsDefaultMessageIDPolicy.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/policy/JmsDefaultMessageIDPolicy.java index 2051561..870de3d 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/policy/JmsDefaultMessageIDPolicy.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/policy/JmsDefaultMessageIDPolicy.java @@ -26,7 +26,8 @@ import org.apache.qpid.jms.message.JmsMessageIDBuilder; */ public class JmsDefaultMessageIDPolicy implements JmsMessageIDPolicy { -private JmsMessageIDBuilder messageIDBuilder = JmsMessageIDBuilder.BUILTIN.DEFAULT.createBuilder(); +private JmsMessageIDBuilder messageIDBuilder = null; +private JmsMessageIDBuilder.BUILTIN messageIDBuilderType = JmsMessageIDBuilder.BUILTIN.DEFAULT; /** * Initialize default Message ID builder policy @@ -42,6 +43,7 @@ public class JmsDefaultMessageIDPolicy implements JmsMessageIDPolicy { */ public JmsDefaultMessageIDPolicy(JmsDefaultMessageIDPolicy source) { this.messageIDBuilder = source.messageIDBuilder; +this.messageIDBuilderType = source.messageIDBuilderType; } @Override @@ -51,7 +53,7 @@ public class JmsDefaultMessageIDPolicy implements JmsMessageIDPolicy { @Override public JmsMessageIDBuilder getMessageIDBuilder(JmsSession session, JmsDestination destination) { -return messageIDBuilder; +return getMessageIDBuilder(); } /** @@ -61,18 +63,22 @@ public class JmsDefaultMessageIDPolicy implements JmsMessageIDPolicy { * The name of the Message type to use when sending a message. */ public void setMessageIDType(String type) { -this.messageIDBuilder = JmsMessageIDBuilder.BUILTIN.create(type); +this.messageIDBuilderType = JmsMessageIDBuil
[qpid-jms] branch QPIDJMS-461 created (now b2300cb)
This is an automated email from the ASF dual-hosted git repository. tabish pushed a change to branch QPIDJMS-461 in repository https://gitbox.apache.org/repos/asf/qpid-jms.git. at b2300cb QPIDJMS-461 Optimize the default message ID builder This branch includes the following new commits: new b2300cb QPIDJMS-461 Optimize the default message ID builder The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch QPIDJMS-461 deleted (was b2300cb)
This is an automated email from the ASF dual-hosted git repository. tabish pushed a change to branch QPIDJMS-461 in repository https://gitbox.apache.org/repos/asf/qpid-jms.git. was b2300cb QPIDJMS-461 Optimize the default message ID builder The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository. - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-461 Optimize the default message ID builder
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new d8a8938 QPIDJMS-461 Optimize the default message ID builder d8a8938 is described below commit d8a893844d8c8879b8fc2aaf89a9e8ebc1608dbb Author: Timothy Bish AuthorDate: Tue Jun 18 10:31:21 2019 -0400 QPIDJMS-461 Optimize the default message ID builder Change the builtin Message ID builder to create a builder per producer and optimize the string handling used to create the Message ID from the producer id and sequence number. --- .../org/apache/qpid/jms/JmsMessageProducer.java| 2 +- .../qpid/jms/message/JmsMessageIDBuilder.java | 63 -- .../qpid/jms/policy/JmsDefaultMessageIDPolicy.java | 27 -- 3 files changed, 81 insertions(+), 11 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageProducer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageProducer.java index e44b132..921dc70 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageProducer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageProducer.java @@ -64,7 +64,7 @@ public class JmsMessageProducer implements AutoCloseable, MessageProducer { this.anonymousProducer = destination == null; JmsMessageIDBuilder messageIDBuilder = -session.getMessageIDPolicy().getMessageIDBuilder(session, destination); +session.getMessageIDPolicy().getMessageIDBuilder(session, destination).initialize(producerId.toString()); this.producerInfo = new JmsProducerInfo(producerId, messageIDBuilder); this.producerInfo.setDestination(destination); diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java index 319506b..9d5b002 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageIDBuilder.java @@ -30,15 +30,38 @@ public interface JmsMessageIDBuilder { DEFAULT { @Override public JmsMessageIDBuilder createBuilder() { + +/** + * The default builder is meant to be used as a single instance per producer + * and will yield incorrect results if used across multiple producer instances. + */ return new JmsMessageIDBuilder() { +private final StringBuilder builder = new StringBuilder(); +private int idPrefixLength = -1; + @Override public Object createMessageID(String producerId, long messageSequence) { -String messageId = producerId + "-" + messageSequence; -if (!AmqpMessageIdHelper.hasMessageIdPrefix(messageId)) { -messageId = AmqpMessageIdHelper.JMS_ID_PREFIX + messageId; +if (idPrefixLength < 0) { +initialize(producerId); +} + +builder.setLength(idPrefixLength); +builder.append(messageSequence); + +return builder.toString(); +} + +@Override +public JmsMessageIDBuilder initialize(String producerId) { +if (!AmqpMessageIdHelper.hasMessageIdPrefix(producerId)) { +builder.append(AmqpMessageIdHelper.JMS_ID_PREFIX); } -return messageId; +builder.append(producerId).append("-"); + +idPrefixLength = builder.length(); + +return this; } @Override @@ -113,7 +136,21 @@ public interface JmsMessageIDBuilder { * @throws IllegalArgumentException if the named type is unknown. */ public static JmsMessageIDBuilder create(String value) { -return valueOf(value.toUpperCase(Locale.ENGLISH)).createBuilder(); +return validate(value).createBuilder(); +} + +/** + * Validates the value given maps to the built in message ID builders and + * return the builder enumeration that it maps to which can later be used + * to create builders of that type. + * + * @param value + * The name of one of the built in message ID builders. + * + * @return the enumeration value that maps to the built in builder. + */ +public static BUILTI
[qpid-jms] branch master updated (ce06c6f -> 699f554)
This is an automated email from the ASF dual-hosted git repository. tabish pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git. from ce06c6f QPIDJMS-468: send disposition for delivered messages upon CLIENT_ACK session shutdown new a00b896 NO-JIRA tweak some tests to avoid race on peer start / setup new 699f554 QPIDJMS-469 Remove some unused variabels and code blocks The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../org/apache/qpid/jms/JmsMessageConsumer.java| 1 - .../qpid/jms/provider/amqp/AmqpFixedProducer.java | 9 - .../provider/failover/FailoverIntegrationTest.java | 41 ++ 3 files changed, 27 insertions(+), 24 deletions(-) - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] 01/02: NO-JIRA tweak some tests to avoid race on peer start / setup
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git commit a00b896bfbcc3cb68ba3e407f96bf8db16d11276 Author: Timothy Bish AuthorDate: Fri Aug 2 14:56:08 2019 -0400 NO-JIRA tweak some tests to avoid race on peer start / setup --- .../provider/failover/FailoverIntegrationTest.java | 41 ++ 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java index f79f16c..39a9a94 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java @@ -3619,13 +3619,13 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { private void doCreateTemporaryDestinationFailsWhenLinkRefusedTestImpl(boolean topic, boolean deferAttachResponseWrite) throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { -JmsConnection connection = establishAnonymousConnecton(testPeer); testPeer.expectSaslAnonymous(); testPeer.expectOpen(); testPeer.expectBegin(); testPeer.expectBegin(); +JmsConnection connection = establishAnonymousConnecton(testPeer); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -3661,6 +3661,12 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { final CountDownLatch producerClosed = new CountDownLatch(1); + +testPeer.expectSaslAnonymous(); +testPeer.expectOpen(); +testPeer.expectBegin(); +testPeer.expectBegin(); + JmsConnection connection = establishAnonymousConnecton(testPeer); connection.addConnectionListener(new JmsDefaultConnectionListener() { @Override @@ -3668,12 +3674,6 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { producerClosed.countDown(); } }); - -testPeer.expectSaslAnonymous(); -testPeer.expectOpen(); -testPeer.expectBegin(); -testPeer.expectBegin(); - connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -3723,15 +3723,19 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { @Test(timeout = 2) public void testPassthroughOfSendFailsWhenDelayedDeliveryIsNotSupported() throws Exception { -try (TestAmqpPeer testPeer = new TestAmqpPeer();) { -// DO NOT add capability to indicate server support for DELAYED-DELIVERY -JmsConnection connection = establishAnonymousConnecton(testPeer); +try (TestAmqpPeer testPeer = new TestAmqpPeer()) { + +final String testPeerURI = createPeerURI(testPeer); +LOG.info("Original peer is at: {}", testPeerURI); testPeer.expectSaslAnonymous(); testPeer.expectOpen(); testPeer.expectBegin(); testPeer.expectBegin(); +// DO NOT add capability to indicate server support for DELAYED-DELIVERY so that +// send fails and we can see if the error passes through the failover provider +JmsConnection connection = establishAnonymousConnecton(testPeer); connection.start(); Matcher desiredCapabilitiesMatcher = arrayContaining(new Symbol[] { DELAYED_DELIVERY }); @@ -3765,14 +3769,17 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { @Test(timeout = 2) public void testPassthroughOfSendTimesOutWhenNoDispostionArrives() throws Exception { -try(TestAmqpPeer testPeer = new TestAmqpPeer();) { -JmsConnection connection = establishAnonymousConnecton(testPeer); +try (TestAmqpPeer testPeer = new TestAmqpPeer();) { + +final String testPeerURI = createPeerURI(testPeer); +LOG.info("Original peer is at: {}", testPeerURI); testPeer.expectSaslAnonymous(); testPeer.expectOpen(); testPeer.expectBegin(); testPeer.expectBegin(); +JmsConnection connection = establishAnonymousConnecton(testPeer); connection.setSendTimeout(500); connection.start(); @@ -3810,7 +3817,9 @@ public class FailoverIntegrationTest extends QpidJmsTestCase { @Test(timeout=2) public void testPassthroughOfRollbackErrorCoordinatorClosedOnCommit() throws Exception {
[qpid-jms] 02/02: QPIDJMS-469 Remove some unused variabels and code blocks
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git commit 699f5549da1d47c7409f16d3e99f0dba2d225e32 Author: Timothy Bish AuthorDate: Fri Aug 2 14:58:22 2019 -0400 QPIDJMS-469 Remove some unused variabels and code blocks Removes an unused atomic boolean in the consumer and a no longer used async result and set block that is no longer used by the producer --- .../src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java| 1 - .../org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java | 9 - 2 files changed, 10 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java index a437f76..7cec9b5 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java @@ -69,7 +69,6 @@ public class JmsMessageConsumer implements AutoCloseable, MessageConsumer, JmsMe protected final MessageQueue messageQueue; protected final Lock lock = new ReentrantLock(); protected final Lock dispatchLock = new ReentrantLock(); -protected final AtomicBoolean suspendedConnection = new AtomicBoolean(); protected final AtomicReference failureCause = new AtomicReference<>(); protected final MessageDeliverTask deliveryTask = new MessageDeliverTask(); diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java index d54f1f4..3c79fd7 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java @@ -63,8 +63,6 @@ public class AmqpFixedProducer extends AmqpProducer { private final Map sent = new LinkedHashMap(); private final Map blocked = new LinkedHashMap(); -private AsyncResult sendCompletionWatcher; - private final AmqpConnection connection; public AmqpFixedProducer(AmqpSession session, JmsProducerInfo info, Sender sender) { @@ -404,13 +402,6 @@ public class AmqpFixedProducer extends AmqpProducer { // Put the message back to usable state following send complete envelope.getMessage().onSendComplete(); -// Signal the watcher that all pending sends have completed if one is registered -// and both the in-flight sends and blocked sends have completed. -if (sendCompletionWatcher != null && sent.isEmpty() && blocked.isEmpty()) { -sendCompletionWatcher.onSuccess(); -sendCompletionWatcher = null; -} - // Once the pending sends queue is drained and all in-flight sends have been // settled we can propagate the close request. if (isAwaitingClose() && !isClosed() && blocked.isEmpty() && sent.isEmpty()) { - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-proton-j] branch master updated: PROTON-2084 Only use the key type restriction on top level Map keys
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git The following commit(s) were added to refs/heads/master by this push: new 046afce PROTON-2084 Only use the key type restriction on top level Map keys 046afce is described below commit 046afcef853ee0ccdf7a668e154f1232a3cc8218 Author: Timothy Bish AuthorDate: Tue Aug 6 18:52:25 2019 -0400 PROTON-2084 Only use the key type restriction on top level Map keys Don't apply the fixed key type to other Maps that are nested inside a map with a key type retriction. --- .../java/org/apache/qpid/proton/codec/MapType.java | 125 + .../codec/MessageAnnotationsTypeCodecTest.java | 45 +++- 2 files changed, 122 insertions(+), 48 deletions(-) diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java index b791c91..40c27b2 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; +@SuppressWarnings({ "rawtypes", "unchecked" }) public class MapType extends AbstractPrimitiveType { private final MapEncoding _mapEncoding; @@ -62,8 +63,8 @@ public class MapType extends AbstractPrimitiveType @Override public MapEncoding getEncoding(final Map val) { -int calculatedSize = calculateSize(val, _encoder, fixedKeyType); -MapEncoding encoding = (val.size() > 127 || calculatedSize >= 254) +final int calculatedSize = calculateSize(val); +final MapEncoding encoding = (val.size() > 127 || calculatedSize >= 254) ? _mapEncoding : _shortMapEncoding; @@ -71,26 +72,38 @@ public class MapType extends AbstractPrimitiveType return encoding; } -private static int calculateSize(final Map map, EncoderImpl encoder, AMQPType fixedKeyType) +private int calculateSize(final Map map) { int len = 0; -Iterator iter = map.entrySet().iterator(); + +final Iterator> iter = map.entrySet().iterator(); +final AMQPType fixedKeyType = this.fixedKeyType; + +// Clear existing fixed key type encoding to prevent application to nested Maps +setKeyEncoding(null); while (iter.hasNext()) { -Map.Entry element = iter.next(); +final Map.Entry element = iter.next(); +TypeEncoding elementEncoding; -AMQPType keyType = fixedKeyType; if (fixedKeyType == null) { -keyType = encoder.getType(element.getKey()); +elementEncoding = _encoder.getType(element.getKey()).getEncoding(element.getKey()); +} +else +{ +elementEncoding = fixedKeyType.getEncoding(element.getKey()); } -TypeEncoding elementEncoding = keyType.getEncoding(element.getKey()); -len += elementEncoding.getConstructorSize()+elementEncoding.getValueSize(element.getKey()); -elementEncoding = encoder.getType(element.getValue()).getEncoding(element.getValue()); -len += elementEncoding.getConstructorSize()+elementEncoding.getValueSize(element.getValue()); +len += elementEncoding.getConstructorSize() + elementEncoding.getValueSize(element.getKey()); +elementEncoding = _encoder.getType(element.getValue()).getEncoding(element.getValue()); +len += elementEncoding.getConstructorSize() + elementEncoding.getValueSize(element.getValue()); } + +// Reset Existing key type encoding for later encode step or reuse until cleared by caller +setKeyEncoding(fixedKeyType); + return len; } @@ -109,7 +122,7 @@ public class MapType extends AbstractPrimitiveType } else { -PrimitiveTypeEncoding primitiveConstructor = (PrimitiveTypeEncoding) previousConstructor; +final PrimitiveTypeEncoding primitiveConstructor = (PrimitiveTypeEncoding) previousConstructor; if (encodingCode != primitiveConstructor.getEncodingCode()) { return decoder.readConstructor(); @@ -156,31 +169,41 @@ public class MapType extends AbstractPrimitiveType getEncoder().getBuffer().ensureRemaining(getSizeBytes() + getEncodedValueSize(map)); getEncoder().writeRaw(2 * map.size()); -Iterator iter = map.entrySet().iterator(); +final Iterator iter = map.entrySet().iterator(); +final AMQPType fixedKeyType = MapType.this.fixedKeyType
[qpid-jms] branch master updated: NO-JIRA Change how netty server used in tests selects free port
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 122bdce NO-JIRA Change how netty server used in tests selects free port 122bdce is described below commit 122bdce3d16083deaa5b4f5ac5502e784c0ab12d Author: Timothy Bish AuthorDate: Thu Aug 29 12:03:13 2019 -0400 NO-JIRA Change how netty server used in tests selects free port Let the netty layer bind to a free port instead of choosing one ourselves to avoid race on port leading to address in use errors in CI --- .../qpid/jms/transports/netty/NettyServer.java | 37 +- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyServer.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyServer.java index fc7f0c4..f09b08f 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyServer.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyServer.java @@ -19,15 +19,13 @@ package org.apache.qpid.jms.transports.netty; import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; -import java.io.IOException; -import java.net.ServerSocket; +import java.net.InetSocketAddress; import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import javax.net.ServerSocketFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; @@ -79,13 +77,14 @@ public abstract class NettyServer implements AutoCloseable { static final int PORT = Integer.parseInt(System.getProperty("port", "8007")); static final String WEBSOCKET_PATH = "/"; +static final int SERVER_CHOOSES_PORT = 0; private EventLoopGroup bossGroup; private EventLoopGroup workerGroup; private Channel serverChannel; private final TransportOptions options; private final boolean secure; -private int serverPort; +private int serverPort = SERVER_CHOOSES_PORT; private final boolean needClientAuth; private final boolean webSocketServer; private int maxFrameSize = NettyTcpTransport.DEFAULT_MAX_FRAME_SIZE; @@ -190,10 +189,13 @@ public abstract class NettyServer implements AutoCloseable { } public void start() throws Exception { +start(serverPort); +} +public void start(int listenOn) throws Exception { if (started.compareAndSet(false, true)) { -// Configure the server. +// Basic server configuration with NIO only options. bossGroup = new NioEventLoopGroup(1); workerGroup = new NioEventLoopGroup(); @@ -227,8 +229,11 @@ public abstract class NettyServer implements AutoCloseable { } }); -// Start the server. -serverChannel = server.bind(getServerPort()).sync().channel(); +// Start the server using specified port. If value is zero the server +// will select a free port and so we update the server port value after +// in order to reflect the correct value. +serverChannel = server.bind(listenOn).sync().channel(); +serverPort = ((InetSocketAddress) serverChannel.localAddress()).getPort(); } } @@ -260,22 +265,10 @@ public abstract class NettyServer implements AutoCloseable { } public int getServerPort() { -if (serverPort == 0) { -ServerSocket ss = null; -try { -ss = ServerSocketFactory.getDefault().createServerSocket(0); -serverPort = ss.getLocalPort(); -} catch (IOException e) { // revert back to default -serverPort = PORT; -} finally { -try { -if (ss != null ) { -ss.close(); -} -} catch (IOException e) { // ignore -} -} +if (!started.get()) { +throw new IllegalStateException("Cannot get server port of non-started server"); } + return serverPort; } - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-476 Enhance anonymous fallback producer to allow asynchronous sends
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new e04e3f8 QPIDJMS-476 Enhance anonymous fallback producer to allow asynchronous sends e04e3f8 is described below commit e04e3f847859cddecc4704d6a9c628cf435bf97f Author: Timothy Bish AuthorDate: Mon Sep 30 15:07:50 2019 -0400 QPIDJMS-476 Enhance anonymous fallback producer to allow asynchronous sends Improves performance of anonymous fallback producer mode by allowing asynchronous sends and sends that reuse existing cache anonymous fallback producer instances avoiding the need for open -> send -> close on each send. --- .../amqp/AmqpAnonymousFallbackProducer.java| 388 +- .../qpid/jms/provider/amqp/AmqpConnection.java | 37 + .../qpid/jms/provider/amqp/AmqpFixedProducer.java |9 +- .../qpid/jms/provider/amqp/AmqpProvider.java | 41 + .../AnonymousFallbackProducerIntegrationTest.java | 1428 .../jms/integration/ProducerIntegrationTest.java | 278 .../jms/integration/SessionIntegrationTest.java| 10 +- .../provider/failover/FailoverIntegrationTest.java | 61 + qpid-jms-docs/Configuration.md |2 + 9 files changed, 1908 insertions(+), 346 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAnonymousFallbackProducer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAnonymousFallbackProducer.java index 63e5cbb..b3ae647 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAnonymousFallbackProducer.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAnonymousFallbackProducer.java @@ -16,16 +16,26 @@ */ package org.apache.qpid.jms.provider.amqp; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ScheduledFuture; +import org.apache.qpid.jms.JmsDestination; import org.apache.qpid.jms.message.JmsOutboundMessageDispatch; import org.apache.qpid.jms.meta.JmsProducerId; import org.apache.qpid.jms.meta.JmsProducerInfo; import org.apache.qpid.jms.provider.AsyncResult; +import org.apache.qpid.jms.provider.NoOpAsyncResult; import org.apache.qpid.jms.provider.ProviderException; import org.apache.qpid.jms.provider.WrappedAsyncResult; import org.apache.qpid.jms.provider.amqp.builders.AmqpProducerBuilder; +import org.apache.qpid.jms.provider.exceptions.ProviderIllegalStateException; import org.apache.qpid.jms.util.IdGenerator; +import org.apache.qpid.proton.engine.Delivery; import org.apache.qpid.proton.engine.EndpointState; +import org.apache.qpid.proton.engine.Sender; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,8 +50,11 @@ public class AmqpAnonymousFallbackProducer extends AmqpProducer { private static final Logger LOG = LoggerFactory.getLogger(AmqpAnonymousFallbackProducer.class); private static final IdGenerator producerIdGenerator = new IdGenerator(); +private final AmqpConnection connection; +private final Map producerCache = new LinkedHashMap<>(1, 0.75f, true); private final String producerIdKey = producerIdGenerator.generateId(); private long producerIdCount; +private final ScheduledFuture cacheProducerTimeoutTask; /** * Creates the Anonymous Producer object. @@ -53,36 +66,94 @@ public class AmqpAnonymousFallbackProducer extends AmqpProducer { */ public AmqpAnonymousFallbackProducer(AmqpSession session, JmsProducerInfo info) { super(session, info); + +this.connection = session.getConnection(); + +final long sweeperInterval = connection.getAnonymousProducerCacheTimeout(); +if (sweeperInterval > 0 && connection.getAnonymousProducerCacheSize() > 0) { +LOG.trace("Cached Producer timeout monitoring enabled: interval = {}ms", sweeperInterval); +cacheProducerTimeoutTask = connection.scheduleWithFixedDelay(new CachedProducerSweeper(), sweeperInterval); +} else { +LOG.trace("No Cached Producer timeout monitoring enabled based on configuration."); +cacheProducerTimeoutTask = null; +} } @Override public void send(JmsOutboundMessageDispatch envelope, AsyncResult request) throws ProviderException { LOG.trace("Started send chain for anonymous producer: {}", getProducerId()); +AmqpFallbackProducer producer = producerCache.get(envelope.getDestination()); + +if (producer != null && !producer.isAwaitingClose()) { +producer.send(envelope, request); +} else { +handleSendWhenCachedProducerNotAva
[qpid-jms] branch master updated: NO-JIRA Remove unused call to get transport http headers
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new e793da9 NO-JIRA Remove unused call to get transport http headers e793da9 is described below commit e793da9943fc6c2ccf6e01a6c60a8b97cf8a Author: Timothy Bish AuthorDate: Thu Oct 17 11:51:52 2019 -0400 NO-JIRA Remove unused call to get transport http headers Unused call to transport getHttpHeaders left in code removed and cleaned up the headers apply loop when filling in the Netty Default headers. --- .../org/apache/qpid/jms/transports/netty/NettyWsTransport.java| 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java index 3da8784..52d4013 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyWsTransport.java @@ -19,7 +19,6 @@ package org.apache.qpid.jms.transports.netty; import java.io.IOException; import java.net.URI; import java.nio.charset.StandardCharsets; -import java.util.Map; import org.apache.qpid.jms.transports.TransportListener; import org.apache.qpid.jms.transports.TransportOptions; @@ -135,10 +134,9 @@ public class NettyWsTransport extends NettyTcpTransport { public NettyWebSocketTransportHandler() { DefaultHttpHeaders headers = new DefaultHttpHeaders(); -getTransportOptions().getHttpHeaders(); -for (Map.Entry entry : getTransportOptions().getHttpHeaders().entrySet()) { -headers.set(entry.getKey(), entry.getValue()); -} +getTransportOptions().getHttpHeaders().forEach((key, value) -> { +headers.set(key, value); +}); handshaker = WebSocketClientHandshakerFactory.newHandshaker( getRemoteLocation(), WebSocketVersion.V13, AMQP_SUB_PROTOCOL, - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-489 Update test dependencies to latest
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 8e2551a QPIDJMS-489 Update test dependencies to latest 8e2551a is described below commit 8e2551a30d6876ae6224faa80a13126c59addb4d Author: Timothy Bish AuthorDate: Wed Feb 12 13:57:06 2020 -0500 QPIDJMS-489 Update test dependencies to latest Junit, ActiveMQ, Mockito and Jacoco updates to latest point releases. --- pom.xml | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 8ef338b..bd45d7d 100644 --- a/pom.xml +++ b/pom.xml @@ -49,11 +49,11 @@ 2.0.28.Final -5.15.9 -4.12 +5.15.11 +4.13 1.0 9.4.22.v20191022 -3.1.0 +3.2.4 2.2 2.9.0 @@ -63,7 +63,7 @@ 2.5 4.1.0 3.0.2 -0.8.4 +0.8.5 2.22.2 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-490 Update to slf4j 1.7.30 patch release
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 63c15af QPIDJMS-490 Update to slf4j 1.7.30 patch release 63c15af is described below commit 63c15af8fef7969e25a193df8374246b4ad294eb Author: Timothy Bish AuthorDate: Wed Feb 12 14:04:24 2020 -0500 QPIDJMS-490 Update to slf4j 1.7.30 patch release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bd45d7d..6253def 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ 0.33.3 4.1.45.Final -1.7.25 +1.7.30 1.0-alpha-2 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-491 Close the proton connection when transport error is actioned
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new cec6fa3 QPIDJMS-491 Close the proton connection when transport error is actioned cec6fa3 is described below commit cec6fa36ff606ae00664b40c30e8c936a37c Author: Timothy Bish AuthorDate: Fri Feb 21 11:45:55 2020 -0500 QPIDJMS-491 Close the proton connection when transport error is actioned Ensure that when the transport error event is actioned we close the proton connection locally and then later also check that on resource close if the provider has failed we don't wait for a remote response that is never going to come. --- .../qpid/jms/provider/amqp/AmqpAbstractResource.java | 7 +-- .../org/apache/qpid/jms/provider/amqp/AmqpProvider.java | 16 +++- .../jms/integration/TransactionsIntegrationTest.java | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java index 4507959..246fcbc 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java @@ -87,9 +87,12 @@ public abstract class AmqpAbstractResource getAlternateURIs() { List alternates = new ArrayList<>(); diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java index 5eeecdb..abfd4b5 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java @@ -1688,6 +1688,7 @@ public class TransactionsIntegrationTest extends QpidJmsTestCase { } } +@Repeat(repetitions = 1) @Test(timeout=2) public void testTransactionDeclaredDispositionWithoutTxnId() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: NO-JIRA: Fix logger to not box value
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new b37fed5 NO-JIRA: Fix logger to not box value b37fed5 is described below commit b37fed5df3a0008921207565a2092771755a5143 Author: Timothy Bish AuthorDate: Fri Feb 21 14:11:45 2020 -0500 NO-JIRA: Fix logger to not box value Pass the buffer object itself as the toString would provide the data if logger is enabled --- .../java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java index 38d7465..10b5a39 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java @@ -256,14 +256,14 @@ public class NettyTcpTransport implements Transport { @Override public void write(ByteBuf output) throws IOException { checkConnected(output); -LOG.trace("Attempted write of: {} bytes", output.readableBytes()); +LOG.trace("Attempted write of buffer: {}", output); channel.write(output, channel.voidPromise()); } @Override public void writeAndFlush(ByteBuf output) throws IOException { checkConnected(output); -LOG.trace("Attempted write and flush of: {} bytes", output.readableBytes()); +LOG.trace("Attempted write and flush of buffer: {}", output); channel.writeAndFlush(output, channel.voidPromise()); } - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-492 Add a connection extension for injecting properties for Open
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 57ac841 QPIDJMS-492 Add a connection extension for injecting properties for Open 57ac841 is described below commit 57ac841743dff0e54e04ab6c0e003c7b17f0f3d2 Author: Timothy Bish AuthorDate: Tue Feb 25 15:55:55 2020 -0500 QPIDJMS-492 Add a connection extension for injecting properties for Open Allows client code to inject connection properties values into the Open performative. --- .../apache/qpid/jms/JmsConnectionExtensions.java | 23 +++- .../amqp/builders/AmqpConnectionBuilder.java | 14 +- .../jms/integration/ConnectionIntegrationTest.java | 151 + .../provider/failover/FailoverIntegrationTest.java | 98 - 4 files changed, 283 insertions(+), 3 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionExtensions.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionExtensions.java index 5e1b03d..7a4a150 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionExtensions.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionExtensions.java @@ -123,7 +123,28 @@ public enum JmsConnectionExtensions { * * */ -PROXY_HANDLER_SUPPLIER("proxyHandlerSupplier"); +PROXY_HANDLER_SUPPLIER("proxyHandlerSupplier"), + +/** + * Allows a user to inject custom properties into the AMQP Open performative that is sent + * after a successful remote connection has been made. The properties are injected by adding + * {@link String} keys and {@link Object} values into a {@link Map} instance and returning it. + * The value entries in the provided {@link Map} must be valid AMQP primitive types that can + * be encoded to form a valid AMQP Open performative or an error will be thrown and the connection + * attempt will fail. If a user supplied property collides with an internal client specific + * property the client version is always given precedence. + * + * This method will be invoked on the initial connect and on each successive reconnect if a connection + * failures occurs and the client is configured to provide automatic reconnect support. + * + * The extension function takes the form of a BiFunction defined as the following: + * + * + * {@link BiFunction}<{@link Connection}, {@link URI}, {@link Map}> + * + * + */ +AMQP_OPEN_PROPERTIES("amqpOpenProperties"); private final String extensionKey; diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConnectionBuilder.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConnectionBuilder.java index fb8d625..188111f 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConnectionBuilder.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/builders/AmqpConnectionBuilder.java @@ -29,6 +29,7 @@ import java.util.Map; import javax.jms.Session; +import org.apache.qpid.jms.JmsConnectionExtensions; import org.apache.qpid.jms.meta.JmsConnectionInfo; import org.apache.qpid.jms.meta.JmsSessionInfo; import org.apache.qpid.jms.provider.AsyncResult; @@ -104,6 +105,7 @@ public class AmqpConnectionBuilder extends AmqpResourceBuilder props = new LinkedHashMap(); +final Map props = new LinkedHashMap(); + +if (resourceInfo.getExtensionMap().containsKey(JmsConnectionExtensions.AMQP_OPEN_PROPERTIES)) { +final Map userConnectionProperties = (Map) resourceInfo.getExtensionMap().get( + JmsConnectionExtensions.AMQP_OPEN_PROPERTIES).apply(resourceInfo.getConnection(), parent.getTransport().getRemoteLocation()); +if (userConnectionProperties != null && !userConnectionProperties.isEmpty()) { +userConnectionProperties.forEach((key, value) -> props.put(Symbol.valueOf(key), value)); +} +} + +// Client properties override anything the user added. props.put(AmqpSupport.PRODUCT, MetaDataSupport.PROVIDER_NAME); props.put(AmqpSupport.VERSION, MetaDataSupport.PROVIDER_VERSION); props.put(AmqpSupport.PLATFORM, MetaDataSupport.PLATFORM_DETAILS); diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java index 4d1a9b2..de001a0 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegration
[qpid-jms] branch master updated: QPIDJMS-493 Updates to latest Netty release and latest Mockito
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new ecbfe43 QPIDJMS-493 Updates to latest Netty release and latest Mockito ecbfe43 is described below commit ecbfe4324d16f2447343f6304dfb4d770f5c2410 Author: Timothy Bish AuthorDate: Fri Feb 28 12:52:30 2020 -0500 QPIDJMS-493 Updates to latest Netty release and latest Mockito --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 329bd5b..005fdfc 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ 0.33.3 -4.1.45.Final +4.1.46.Final 1.7.30 1.0-alpha-2 @@ -53,7 +53,7 @@ 4.13 1.0 9.4.22.v20191022 -3.2.4 +3.3.0 2.2 2.9.0 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: NO-JIRA avoid auto-box of readable bytes value in trace log
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 59960ba NO-JIRA avoid auto-box of readable bytes value in trace log 59960ba is described below commit 59960ba807ffaeb0c25941eea092f2db4992d525 Author: Timothy Bish AuthorDate: Wed Mar 11 17:15:20 2020 -0400 NO-JIRA avoid auto-box of readable bytes value in trace log --- .../java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java index 10b5a39..a329482 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java @@ -557,7 +557,7 @@ public class NettyTcpTransport implements Transport { @Override protected void channelRead0(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { -LOG.trace("New data read: {} bytes incomsing: {}", buffer.readableBytes(), buffer); +LOG.trace("New incoming data read: {}", buffer); // Avoid all doubts to the contrary if (channel.eventLoop().inEventLoop()) { listener.onData(buffer); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-494 Update netty to latest 4.1.48.Final release
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 282279d QPIDJMS-494 Update netty to latest 4.1.48.Final release 282279d is described below commit 282279da25afdf1630328cd7e8e6366e4a708f74 Author: Timothy Bish AuthorDate: Tue Mar 17 12:40:41 2020 -0400 QPIDJMS-494 Update netty to latest 4.1.48.Final release Also updates mockito to latest patch release v3.3.3 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7e49a9a..fb2ece1 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ 0.33.3 -4.1.47.Final +4.1.48.Final 1.7.30 1.0-alpha-2 @@ -53,7 +53,7 @@ 4.13 1.0 9.4.22.v20191022 -3.3.0 +3.3.3 2.2 2.9.0 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: NO-JIRA Fix intermittent failure from peer on sudden socket close
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new cfdefc7 NO-JIRA Fix intermittent failure from peer on sudden socket close cfdefc7 is described below commit cfdefc7895e210fd9e4f25727209e7d18e2d5084 Author: Timothy Bish AuthorDate: Tue Mar 17 14:13:37 2020 -0400 NO-JIRA Fix intermittent failure from peer on sudden socket close Ignore error from test peer on sudden close of socket from client after SASL exchange as that is expected from this test when open performative encode failure occurs. --- .../org/apache/qpid/jms/integration/ConnectionIntegrationTest.java | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java index de001a0..0369950 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java @@ -24,6 +24,7 @@ import static org.apache.qpid.jms.provider.amqp.AmqpSupport.NETWORK_HOST; import static org.apache.qpid.jms.provider.amqp.AmqpSupport.OPEN_HOSTNAME; import static org.apache.qpid.jms.provider.amqp.AmqpSupport.PORT; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.equalTo; @@ -34,7 +35,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -1032,6 +1032,7 @@ public class ConnectionIntegrationTest extends QpidJmsTestCase { public void testConnectionFailsWhenUserSuppliesIllegalProperties() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { +testPeer.setSuppressReadExceptionOnClose(true); testPeer.expectSaslAnonymous(); final URI remoteURI = new URI("amqp://localhost:" + testPeer.getServerPort()); @@ -1052,6 +1053,8 @@ public class ConnectionIntegrationTest extends QpidJmsTestCase { connection.start(); fail("Should not be able to connect when illegal types are in the properties"); } catch (JMSException ex) { +} catch (Exception unexpected) { +fail("Caught unexpected error from connnection.start() : " + unexpected); } testPeer.waitForAllHandlersToComplete(1000); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-494 Update netty tcnative to 2.0.30.Final
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 385c775 QPIDJMS-494 Update netty tcnative to 2.0.30.Final 385c775 is described below commit 385c77581df19e4a745f2d82a7505378ce189b9a Author: Timothy Bish AuthorDate: Thu Mar 19 10:26:06 2020 -0400 QPIDJMS-494 Update netty tcnative to 2.0.30.Final --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index fb2ece1..c920fcd 100644 --- a/pom.xml +++ b/pom.xml @@ -48,8 +48,8 @@ 0.33.0 -2.0.29.Final -5.15.11 +2.0.30.Final +5.15.12 4.13 1.0 9.4.22.v20191022 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: QPIDJMS-499 Update to netty 4.1.49.Final
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new f8e79b7 QPIDJMS-499 Update to netty 4.1.49.Final f8e79b7 is described below commit f8e79b71948b9f9ce201457ce3e95bf4afa8a9cf Author: Timothy Bish AuthorDate: Wed Apr 22 09:29:30 2020 -0400 QPIDJMS-499 Update to netty 4.1.49.Final --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index adf3927..98546f6 100644 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,7 @@ 0.33.4 -4.1.48.Final +4.1.49.Final 1.7.30 1.0-alpha-2 - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
[qpid-jms] branch master updated: NO-JIRA Add some additional tests for config of future factory types
This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-jms.git The following commit(s) were added to refs/heads/master by this push: new 0354695 NO-JIRA Add some additional tests for config of future factory types 0354695 is described below commit 035469573753dd532171dad046f995c73d690873 Author: Timothy Bish AuthorDate: Tue May 19 10:48:03 2020 -0400 NO-JIRA Add some additional tests for config of future factory types --- .../ConnectionFactoryIntegrationTest.java | 64 ++ 1 file changed, 64 insertions(+) diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionFactoryIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionFactoryIntegrationTest.java index d3331d2..82a5490 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionFactoryIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionFactoryIntegrationTest.java @@ -30,6 +30,7 @@ import java.net.URI; import java.util.UUID; import javax.jms.Connection; +import javax.jms.JMSException; import javax.jms.QueueConnection; import javax.jms.TopicConnection; @@ -478,6 +479,69 @@ public class ConnectionFactoryIntegrationTest extends QpidJmsTestCase { assertTrue(factory.getRedeliveryPolicy() instanceof JmsDefaultRedeliveryPolicy); } +@Test(timeout = 20_000) +public void testConfigureFutureFactoryFromURITypeOfProgressive() throws Exception { +doTestCreateConnectionWithConfiguredFutureFactory("progressive"); +} + +@Test(timeout = 20_000) +public void testConfigureFutureFactoryFromURITypeOfBalanced() throws Exception { +doTestCreateConnectionWithConfiguredFutureFactory("balanced"); +} + +@Test(timeout = 20_000) +public void testConfigureFutureFactoryFromURITypeOfConservative() throws Exception { +doTestCreateConnectionWithConfiguredFutureFactory("conservative"); +} + +private void doTestCreateConnectionWithConfiguredFutureFactory(String futureType) throws Exception { +try (TestAmqpPeer testPeer = new TestAmqpPeer();) { +// Ignore errors from peer close due to not sending any Open / Close frames +testPeer.setSuppressReadExceptionOnClose(true); + +// DONT create a test fixture, we will drive everything directly. +testPeer.expectSaslAnonymous(); + +String uri = "amqp://127.0.0.1:" + testPeer.getServerPort() + "?provider.futureType=" + futureType; + +JmsConnectionFactory factory = new JmsConnectionFactory(uri); + +JmsConnection connection = (JmsConnection) factory.createConnection(); +assertNotNull(connection); + +testPeer.waitForAllHandlersToComplete(1000); + +testPeer.expectOpen(); +testPeer.expectClose(); + +connection.close(); + +testPeer.waitForAllHandlersToCompleteNoAssert(1000); +} +} + +@Test(timeout = 20_000) +public void testConfigureFutureFactoryFromURITypeUnknown() throws Exception { +try (TestAmqpPeer testPeer = new TestAmqpPeer();) { +// Ignore errors from peer close due to not sending any Open / Close frames +testPeer.setSuppressReadExceptionOnClose(true); + +String uri = "amqp://127.0.0.1:" + testPeer.getServerPort() + "?provider.futureType=unknown"; + +JmsConnectionFactory factory = new JmsConnectionFactory(uri); + +try { +factory.createConnection(); +fail("Should not allow a connection to proceed with a bad future factory type"); +} catch (JMSException ex) { +String message = ex.getMessage(); +assertTrue(message.contains("No ProviderFuture implementation")); +} + +testPeer.waitForAllHandlersToCompleteNoAssert(1000); +} +} + //- Custom Policy Objects // private final class CustomJmsMessageIdBuilder implements JmsMessageIDBuilder { - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org