Skip to content

Commit

Permalink
removing typecast after testing
Browse files Browse the repository at this point in the history
  • Loading branch information
VishakaSekar committed Jan 23, 2019
1 parent cf5467f commit 0279aa4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ JMXConnector open(Map<String, Object> connectionMap) throws IOException {
JMXConnector jmxConnector;
final Map<String, Object> env = new HashMap<>();

if(Boolean.valueOf((String)connectionMap.get(Constants.USE_SSL))) {
if(Boolean.valueOf(connectionMap.get(Constants.USE_SSL).toString())) {
//TODO this is not needed as even if you comment it the SSL connections still work.
SslRMIClientSocketFactory sslRMIClientSocketFactory = new SslRMIClientSocketFactory();
env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, sslRMIClientSocketFactory);
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/com/appdynamics/extensions/kafka/KafkaMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@
import com.appdynamics.extensions.kafka.utils.Constants;
import com.appdynamics.extensions.kafka.utils.SslUtils;
import com.appdynamics.extensions.util.AssertUtils;
import com.google.common.collect.Maps;
import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.PatternLayout;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import static com.appdynamics.extensions.kafka.utils.Constants.DEFAULT_METRIC_PREFIX;

Expand Down Expand Up @@ -60,4 +70,31 @@ protected int getTaskCount () {
return servers.size();
}

public static void main(String[] args) throws TaskExecutionException, IOException {

ConsoleAppender ca = new ConsoleAppender();
ca.setWriter(new OutputStreamWriter(System.out));
ca.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
ca.setThreshold(Level.DEBUG);
org.apache.log4j.Logger.getRootLogger().addAppender(ca);


KafkaMonitor monitor = new KafkaMonitor();
final Map<String, String> taskArgs = Maps.newHashMap();
taskArgs.put("config-file", "/Users/vishaka.sekar/AppDynamics/kafka-monitoring-extension/src/main/resources/conf/config.yml");
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
try {
monitor.execute(taskArgs, null);
} catch (Exception e) {
logger.error("Error while running the task", e);
}
}
}, 2, 60, TimeUnit.SECONDS);

}



}

0 comments on commit 0279aa4

Please sign in to comment.