Repository: stratos Updated Branches: refs/heads/stratos-4.1.x a242b52be -> 74ec78006
Remove init() call in setEnaled method in ThriftStatisticsPublisher since it is invoked from the constructor. Remove setEnabled(true) call in MockHealthStatisticsNotifier since it is read from thrift-client-config.xml Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/74ec7800 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/74ec7800 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/74ec7800 Branch: refs/heads/stratos-4.1.x Commit: 74ec78006f56adb80ca0141f67940205e8dd85f1 Parents: a242b52 Author: Akila Perera <[email protected]> Authored: Tue Dec 1 18:07:28 2015 +0530 Committer: Akila Perera <[email protected]> Committed: Tue Dec 1 18:07:54 2015 +0530 ---------------------------------------------------------------------- .../publisher/ThriftStatisticsPublisher.java | 13 +++++-------- .../publisher/MockHealthStatisticsNotifier.java | 2 -- 2 files changed, 5 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/74ec7800/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 bf0db61..7af804b 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 @@ -88,8 +88,9 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher { for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) { if (thriftClientInfo.isStatsPublisherEnabled()) { - dataPublisherHolders.add(new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(), - thriftClientInfo.getPassword())); + dataPublisherHolders + .add(new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(), + thriftClientInfo.getPassword())); 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())); @@ -112,9 +113,6 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher { @Override public void setEnabled(boolean enabled) { this.enabled = enabled; - if (this.enabled) { - init(); - } } @Override @@ -134,8 +132,8 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher { try { if (log.isDebugEnabled()) { - log.debug(String.format("Publishing thrift event: [stream] %s [version] %s", - streamDefinition.getName(), streamDefinition.getVersion())); + log.debug(String.format("Publishing thrift event: [stream] %s [version] %s", streamDefinition.getName(), + streamDefinition.getVersion())); } loadBalancingDataPublisher.publish(streamDefinition.getName(), streamDefinition.getVersion(), event); if (log.isDebugEnabled()) { @@ -143,7 +141,6 @@ public class ThriftStatisticsPublisher implements StatisticsPublisher { streamDefinition.getName(), streamDefinition.getVersion())); } - } catch (AgentException e) { if (log.isErrorEnabled()) { log.error(String.format("Could not publish thrift event: [stream] %s [version] %s", http://git-wip-us.apache.org/repos/asf/stratos/blob/74ec7800/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/publisher/MockHealthStatisticsNotifier.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/publisher/MockHealthStatisticsNotifier.java b/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/publisher/MockHealthStatisticsNotifier.java index 4f3de51..637e4bf 100644 --- a/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/publisher/MockHealthStatisticsNotifier.java +++ b/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/publisher/MockHealthStatisticsNotifier.java @@ -44,11 +44,9 @@ public class MockHealthStatisticsNotifier implements Runnable { this.mockMemberContext = mockMemberContext; this.healthStatisticsPublisher = HealthStatisticsPublisherFactory .createHealthStatisticsPublisher(StatisticsPublisherType.WSO2CEP); - this.healthStatisticsPublisher.setEnabled(true); this.inFlightRequestPublisher = InFlightRequestPublisherFactory .createInFlightRequestPublisher(StatisticsPublisherType.WSO2CEP); - this.inFlightRequestPublisher.setEnabled(true); } @Override
