You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/01/26 15:59:55 UTC
[03/10] qpid-jms git commit: add local PPBBAllocator sourced from
ActiveMQ6,
allow the Netty based transports to break their remaining dependency
add local PPBBAllocator sourced from ActiveMQ6, allow the Netty based transports to break their remaining dependency
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/a31cfab8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/a31cfab8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/a31cfab8
Branch: refs/heads/master
Commit: a31cfab856dc8b19083d25e8a508aec18c0e05df
Parents: de9d31e
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Jan 26 11:21:54 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Jan 26 11:21:54 2015 +0000
----------------------------------------------------------------------
.../jms/transports/netty/NettyTcpTransport.java | 1 -
.../netty/PartialPooledByteBufAllocator.java | 156 +++++++++++++++++++
2 files changed, 156 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a31cfab8/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 2fd24e1..5c98f14 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
@@ -42,7 +42,6 @@ import org.apache.qpid.jms.transports.TransportOptions;
import org.apache.qpid.jms.util.IOExceptionSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.vertx.java.core.net.impl.PartialPooledByteBufAllocator;
/**
* TCP based transport that uses Netty as the underlying IO layer.
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a31cfab8/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/PartialPooledByteBufAllocator.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/PartialPooledByteBufAllocator.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/PartialPooledByteBufAllocator.java
new file mode 100644
index 0000000..72c2d5f
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/PartialPooledByteBufAllocator.java
@@ -0,0 +1,156 @@
+/**
+ * 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 io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import io.netty.buffer.CompositeByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+
+/**
+ * A {@link ByteBufAllocator} which is partial pooled. Which means only direct {@link ByteBuf}s are pooled. The rest
+ * is unpooled.
+ *
+ * @author <a href="mailto:nmaurer@redhat.com">Norman Maurer</a>
+ */
+public class PartialPooledByteBufAllocator implements ByteBufAllocator
+{
+ private static final ByteBufAllocator POOLED = new PooledByteBufAllocator(false);
+ private static final ByteBufAllocator UNPOOLED = new UnpooledByteBufAllocator(false);
+
+ public static final PartialPooledByteBufAllocator INSTANCE = new PartialPooledByteBufAllocator();
+
+ private PartialPooledByteBufAllocator()
+ {
+ }
+
+ @Override
+ public ByteBuf buffer()
+ {
+ return UNPOOLED.heapBuffer();
+ }
+
+ @Override
+ public ByteBuf buffer(int initialCapacity)
+ {
+ return UNPOOLED.heapBuffer(initialCapacity);
+ }
+
+ @Override
+ public ByteBuf buffer(int initialCapacity, int maxCapacity)
+ {
+ return UNPOOLED.heapBuffer(initialCapacity, maxCapacity);
+ }
+
+ @Override
+ public ByteBuf ioBuffer()
+ {
+ return UNPOOLED.heapBuffer();
+ }
+
+ @Override
+ public ByteBuf ioBuffer(int initialCapacity)
+ {
+ return UNPOOLED.heapBuffer(initialCapacity);
+ }
+
+ @Override
+ public ByteBuf ioBuffer(int initialCapacity, int maxCapacity)
+ {
+ return UNPOOLED.heapBuffer(initialCapacity, maxCapacity);
+ }
+
+ @Override
+ public ByteBuf heapBuffer()
+ {
+ return UNPOOLED.heapBuffer();
+ }
+
+ @Override
+ public ByteBuf heapBuffer(int initialCapacity)
+ {
+ return UNPOOLED.heapBuffer(initialCapacity);
+ }
+
+ @Override
+ public ByteBuf heapBuffer(int initialCapacity, int maxCapacity)
+ {
+ return UNPOOLED.heapBuffer(initialCapacity, maxCapacity);
+ }
+
+ @Override
+ public ByteBuf directBuffer()
+ {
+ return POOLED.directBuffer();
+ }
+
+ @Override
+ public ByteBuf directBuffer(int initialCapacity)
+ {
+ return POOLED.directBuffer(initialCapacity);
+ }
+
+ @Override
+ public ByteBuf directBuffer(int initialCapacity, int maxCapacity)
+ {
+ return POOLED.directBuffer(initialCapacity, maxCapacity);
+ }
+
+ @Override
+ public CompositeByteBuf compositeBuffer()
+ {
+ return UNPOOLED.compositeHeapBuffer();
+ }
+
+ @Override
+ public CompositeByteBuf compositeBuffer(int maxNumComponents)
+ {
+ return UNPOOLED.compositeHeapBuffer(maxNumComponents);
+ }
+
+ @Override
+ public CompositeByteBuf compositeHeapBuffer()
+ {
+ return UNPOOLED.compositeHeapBuffer();
+ }
+
+ @Override
+ public CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
+ {
+ return UNPOOLED.compositeHeapBuffer(maxNumComponents);
+ }
+
+ @Override
+ public CompositeByteBuf compositeDirectBuffer()
+ {
+ return POOLED.compositeDirectBuffer();
+ }
+
+ @Override
+ public CompositeByteBuf compositeDirectBuffer(int maxNumComponents)
+ {
+ return POOLED.compositeDirectBuffer();
+ }
+
+ @Override
+ public boolean isDirectBufferPooled()
+ {
+ return true;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org