summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2012-06-15 17:22:29 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2012-06-15 17:22:29 +0000
commit152aa820ef2b024f6481b378b4bf7f87ff1f0565 (patch)
treeae06fa082ddb2fc687bdaff566f7abeb2743de08
parent36d754c78ed94f696785ce168191165bde19ac88 (diff)
downloadqpid-python-152aa820ef2b024f6481b378b4bf7f87ff1f0565.tar.gz
QPID-4027 The Connection object will provide a reference to the
respective MessageFactory that can be used or creating messages or decoding content for messages received. Since a connection object will contain the AMQP version it would be the logical place to provide this reference. git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/address-refactor2@1350708 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/client-api/src/main/java/org/apache/qpid/messaging/Connection.java12
-rw-r--r--qpid/java/client-api/src/main/java/org/apache/qpid/messaging/util/ConnectionManagementDecorator.java7
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java3
3 files changed, 18 insertions, 4 deletions
diff --git a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/Connection.java b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/Connection.java
index 323f6c877c..04241cd468 100644
--- a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/Connection.java
+++ b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/Connection.java
@@ -44,7 +44,7 @@ public interface Connection
* @param name Unique identifier for the session.
* @return Session
*/
- public Session createSession(String name)throws MessagingException;
+ public Session createSession(String name) throws MessagingException;
/**
* Creates a transactional session with the given name.
@@ -53,7 +53,7 @@ public interface Connection
* @param name Unique identifier for the session.
* @return Session
*/
- public Session createTransactionalSession(String name)throws MessagingException;
+ public Session createTransactionalSession(String name) throws MessagingException;
/**
* Returns the authenticated username for this connection.
@@ -62,5 +62,11 @@ public interface Connection
* For KERBEROS the username will be the kerberos username.
* @return The authenticated username.
*/
- public String getAuthenticatedUsername()throws MessagingException;
+ public String getAuthenticatedUsername() throws MessagingException;
+
+ /**
+ * Returns a reference to the message factory for this connection.
+ * @return MessageFactory
+ */
+ public MessageFactory getMessageFactory();
}
diff --git a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/util/ConnectionManagementDecorator.java b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/util/ConnectionManagementDecorator.java
index e6a115bc20..f635cfcac5 100644
--- a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/util/ConnectionManagementDecorator.java
+++ b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/util/ConnectionManagementDecorator.java
@@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.qpid.messaging.Connection;
import org.apache.qpid.messaging.ConnectionException;
+import org.apache.qpid.messaging.MessageFactory;
import org.apache.qpid.messaging.MessagingException;
import org.apache.qpid.messaging.Session;
import org.apache.qpid.messaging.SessionException;
@@ -179,6 +180,12 @@ public class ConnectionManagementDecorator implements ConnectionExt
}
@Override
+ public MessageFactory getMessageFactory()
+ {
+ return _delegate.getMessageFactory();
+ }
+
+ @Override
public void addConnectionStateListener(ConnectionStateListener l) throws ConnectionException
{
checkClosedAndThrowException();
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java
index d9150bed65..4939f68048 100644
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java
+++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java
@@ -34,11 +34,12 @@ import java.util.UUID;
*/
public final class BBEncoder extends AbstractEncoder
{
+ private static boolean ALLOCATE_DIRECT = Boolean.getBoolean("qpid.allocate-direct");
private ByteBuffer out;
private int segment;
public BBEncoder(int capacity) {
- out = ByteBuffer.allocate(capacity);
+ out = ALLOCATE_DIRECT? ByteBuffer.allocateDirect(capacity) : ByteBuffer.allocate(capacity);
out.order(ByteOrder.BIG_ENDIAN);
segment = 0;
}