From 3a8a1bc3ca4ae73f7475d665c82666c91dfe99cc Mon Sep 17 00:00:00 2001 From: duhenglucky Date: Fri, 17 May 2019 10:29:18 +0800 Subject: [PATCH] Add comment for AccessChannel class --- .../apache/rocketmq/client/AccessChannel.java | 16 ++++++++++++++-- .../org/apache/rocketmq/client/ClientConfig.java | 2 +- .../client/trace/AsyncTraceDispatcher.java | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/client/src/main/java/org/apache/rocketmq/client/AccessChannel.java b/client/src/main/java/org/apache/rocketmq/client/AccessChannel.java index 82978b0a..d6feb579 100644 --- a/client/src/main/java/org/apache/rocketmq/client/AccessChannel.java +++ b/client/src/main/java/org/apache/rocketmq/client/AccessChannel.java @@ -15,7 +15,19 @@ * limitations under the License. */ package org.apache.rocketmq.client; + +/** + * Used for set access channel, if need migrate the rocketmq service to cloud, it is We recommend set the value with + * "CLOUD". otherwise set with "LOCAL", especially used the message trace feature. + */ public enum AccessChannel { - local, - cloud, + /** + * Means connect to private IDC cluster. + */ + LOCAL, + + /** + * Means connect to Cloud service. + */ + CLOUD, } diff --git a/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java b/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java index 53ac3538..87c01a5b 100644 --- a/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java +++ b/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java @@ -37,7 +37,7 @@ public class ClientConfig { private String instanceName = System.getProperty("rocketmq.client.name", "DEFAULT"); private int clientCallbackExecutorThreads = Runtime.getRuntime().availableProcessors(); protected String namespace; - protected AccessChannel accessChannel = AccessChannel.local; + protected AccessChannel accessChannel = AccessChannel.LOCAL; /** * Pulling topic information interval from the named server diff --git a/client/src/main/java/org/apache/rocketmq/client/trace/AsyncTraceDispatcher.java b/client/src/main/java/org/apache/rocketmq/client/trace/AsyncTraceDispatcher.java index 3b5fc1d0..ca3bcfa2 100644 --- a/client/src/main/java/org/apache/rocketmq/client/trace/AsyncTraceDispatcher.java +++ b/client/src/main/java/org/apache/rocketmq/client/trace/AsyncTraceDispatcher.java @@ -72,7 +72,7 @@ public class AsyncTraceDispatcher implements TraceDispatcher { private String dispatcherId = UUID.randomUUID().toString(); private String traceTopicName; private AtomicBoolean isStarted = new AtomicBoolean(false); - private AccessChannel accessChannel = AccessChannel.local; + private AccessChannel accessChannel = AccessChannel.LOCAL; public AsyncTraceDispatcher(String traceTopicName, RPCHook rpcHook) { // queueSize is greater than or equal to the n power of 2 of value @@ -341,7 +341,7 @@ public class AsyncTraceDispatcher implements TraceDispatcher { */ private void sendTraceDataByMQ(Set keySet, final String data, String dataTopic, String regionId) { String traceTopic = traceTopicName; - if (AccessChannel.cloud == accessChannel){ + if (AccessChannel.CLOUD == accessChannel) { traceTopic = TraceConstants.TRACE_TOPIC_PREFIX + regionId; } final Message message = new Message(traceTopic, data.getBytes()); -- GitLab