You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/12/08 16:18:08 UTC

[25/50] [abbrv] stratos git commit: Formatting ThriftStatisticsPublisher class

Formatting ThriftStatisticsPublisher class


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/cd06c7b0
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/cd06c7b0
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/cd06c7b0

Branch: refs/heads/master
Commit: cd06c7b0c4fb8051b78590fe3e7a6fa085b386b7
Parents: e129b80
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 13:28:54 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Dec 1 08:57:54 2015 +0530

----------------------------------------------------------------------
 .../publisher/ThriftStatisticsPublisher.java    | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/cd06c7b0/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
index f86293a..c26c6d3 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
@@ -83,27 +83,28 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher {
     private ArrayList<ReceiverGroup> getReceiverGroups() {
 
         ArrayList<ReceiverGroup> receiverGroups = new ArrayList<ReceiverGroup>();
+        ArrayList<DataPublisherHolder> dataPublisherHolders = new ArrayList<DataPublisherHolder>();
+        DataPublisherHolder aNode;
 
         for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) {
             if (thriftClientInfo.isStatsPublisherEnabled()) {
-                ArrayList<DataPublisherHolder> dataPublisherHolders = new ArrayList<DataPublisherHolder>();
-                DataPublisherHolder aNode = new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(), thriftClientInfo.getPassword());
+                aNode = new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(),
+                        thriftClientInfo.getPassword());
                 dataPublisherHolders.add(aNode);
-                ReceiverGroup group = new ReceiverGroup(dataPublisherHolders);
-                receiverGroups.add(group);
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("Thrift client [id] %s [ip] %s [port] %s is added to data publisher holder",
+                            thriftClientInfo.getId(), thriftClientInfo.getIp(), thriftClientInfo.getPort()));
+                }
             }
         }
+        ReceiverGroup group = new ReceiverGroup(dataPublisherHolders);
+        receiverGroups.add(group);
         return receiverGroups;
 
     }
 
     private String buildUrl(ThriftClientInfo thriftClientInfo) {
-        String url = new StringBuilder()
-                .append("tcp://")
-                .append(thriftClientInfo.getIp())
-                .append(":")
-                .append(thriftClientInfo.getPort()).toString();
-        return url;
+        return String.format("tcp://%s:%s", thriftClientInfo.getIp(), thriftClientInfo.getPort());
     }
 
     @Override