You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2020/02/27 18:20:12 UTC
[cxf] 02/02: cxf-rt-transports-jms: update
JMSUtil.createCorrelationId
This is an automated email from the ASF dual-hosted git repository.
buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 49a3be1484462eec124524805e7439906fb18a33
Author: Alexey Markevich <bu...@gmail.com>
AuthorDate: Thu Feb 27 21:18:41 2020 +0300
cxf-rt-transports-jms: update JMSUtil.createCorrelationId
---
.../main/java/org/apache/cxf/transport/jms/util/JMSUtil.java | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSUtil.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSUtil.java
index 2ac8c4d..a444199 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSUtil.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSUtil.java
@@ -28,6 +28,7 @@ import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.Session;
+import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.transport.jms.JMSConstants;
@@ -35,9 +36,6 @@ public final class JMSUtil {
public static final String JMS_MESSAGE_CONSUMER = "jms_message_consumer";
public static final String JMS_IGNORE_TIMEOUT = "jms_ignore_timeout";
- private static final char[] CORRELATTION_ID_PADDING = {
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'
- };
private JMSUtil() {
}
@@ -95,12 +93,8 @@ public final class JMSUtil {
return new RuntimeException(e.getMessage(), e);
}
- public static String createCorrelationId(final String prefix, long sequenceNUm) {
- String index = Long.toHexString(sequenceNUm);
- StringBuilder id = new StringBuilder(prefix);
- id.append(CORRELATTION_ID_PADDING, 0, 16 - index.length());
- id.append(index);
- return id.toString();
+ public static String createCorrelationId(final String prefix, long sequenceNum) {
+ return prefix + StringUtils.toHexString(java.nio.ByteBuffer.allocate(Long.BYTES).putLong(sequenceNum).array());
}
/**