From 656b95438af9400a08d0813bd9af4adea885fbf4 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Wed, 1 Oct 2008 19:27:19 +0000 Subject: This is in response to Rafis comments on QPID-943. The userid is now converted into bytes using the UTF-8 encoding and the result is cached. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@700886 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'java/client') diff --git a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java index 2810b37d48..ef8aeb58a1 100644 --- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java +++ b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java @@ -35,6 +35,7 @@ import org.apache.qpid.client.protocol.AMQProtocolHandler; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.BasicContentHeaderProperties; import org.apache.qpid.url.AMQBindingURL; +import org.apache.qpid.util.Strings; import org.apache.qpid.nclient.util.ByteBufferMessage; import org.apache.qpid.njms.ExceptionHelper; import org.apache.qpid.transport.*; @@ -45,6 +46,7 @@ import static org.apache.qpid.transport.Option.*; */ public class BasicMessageProducer_0_10 extends BasicMessageProducer { + private byte[] userIDBytes; BasicMessageProducer_0_10(AMQConnection connection, AMQDestination destination, boolean transacted, int channelId, AMQSession session, AMQProtocolHandler protocolHandler, long producerId, @@ -52,6 +54,8 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer { super(connection, destination, transacted, channelId, session, protocolHandler, producerId, immediate, mandatory, waitUntilSent); + + userIDBytes = Strings.toUTF8(_userID); } void declareDestination(AMQDestination destination) @@ -78,7 +82,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer MessageProperties messageProps = delegate.getMessageProperties(); // On the receiving side, this will be read in to the JMSXUserID as well. - messageProps.setUserId(_userID.getBytes()); + messageProps.setUserId(userIDBytes); if (messageId != null) { -- cgit v1.2.1