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/07 11:20:00 UTC

[31/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/0dce72ef
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/0dce72ef
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/0dce72ef

Branch: refs/heads/release-4.1.5
Commit: 0dce72ef84e36a90d77d47d51b23b8069842a97c
Parents: 3bb3484
Author: Thanuja <th...@wso2.com>
Authored: Mon Nov 30 13:28:54 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Mon Dec 7 10:16:28 2015 +0000

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


http://git-wip-us.apache.org/repos/asf/stratos/blob/0dce72ef/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