asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject asterixdb git commit: dead code elimination in asterix-events
Date Wed, 19 Oct 2016 05:22:13 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master e3e49c174 -> 397de7e9b


dead code elimination in asterix-events

Change-Id: I8873652ca6b3add003e7454d09c175b2218ed685
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1300
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>


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

Branch: refs/heads/master
Commit: 397de7e9bd2a62f74e82ef18a367123e26743203
Parents: e3e49c1
Author: Till Westmann <tillw@apache.org>
Authored: Tue Oct 18 11:33:11 2016 -0700
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Tue Oct 18 22:21:49 2016 -0700

----------------------------------------------------------------------
 .../apache/asterix/event/api/ClusterInfo.java   | 30 ----------
 .../org/apache/asterix/event/api/NodeInfo.java  | 38 -------------
 .../asterix/event/driver/EventDriver.java       | 41 ++------------
 .../asterix/event/error/OutputHandler.java      | 17 ++----
 .../asterix/event/error/VerificationUtil.java   | 12 ++--
 .../management/AsterixEventServiceClient.java   |  3 +-
 .../event/management/DefaultOutputHandler.java  | 30 ----------
 .../asterix/event/management/ErrorHandler.java  | 23 --------
 .../asterix/event/management/EventExecutor.java | 58 ++++++++------------
 .../asterix/event/management/EventTask.java     |  4 --
 .../asterix/event/management/EventUtil.java     | 29 +---------
 .../asterix/event/model/AsterixInstance.java    | 22 +-------
 .../apache/asterix/event/model/BackupInfo.java  |  1 -
 .../apache/asterix/event/model/ProcessInfo.java |  8 ---
 .../event/service/AsterixEventService.java      | 14 ++---
 .../event/service/AsterixEventServiceUtil.java  | 12 +---
 .../asterix/event/service/ServiceProvider.java  |  1 -
 .../asterix/event/service/ZooKeeperService.java |  8 +--
 .../asterix/event/util/PatternCreator.java      | 24 +-------
 .../asterix/installer/command/LogCommand.java   |  2 +-
 20 files changed, 54 insertions(+), 323 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/ClusterInfo.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/ClusterInfo.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/ClusterInfo.java
deleted file mode 100644
index d996e0e..0000000
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/ClusterInfo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.event.api;
-
-import java.util.List;
-
-public class ClusterInfo {
-
-    List<NodeInfo> nodes;
-
-    public ClusterInfo(List<NodeInfo> nodes) {
-        this.nodes = nodes;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/NodeInfo.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/NodeInfo.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/NodeInfo.java
deleted file mode 100644
index d2dab4c..0000000
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/NodeInfo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.event.api;
-
-public class NodeInfo {
-
-    private final String id;
-    private final String ip;
-
-    public NodeInfo(String id, String ip) {
-        this.id = id;
-        this.ip = ip;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public String getIp() {
-        return ip;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
index c92262c..415433e 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
@@ -41,33 +41,17 @@ import org.kohsuke.args4j.CmdLineParser;
 public class EventDriver {
 
     public static final String CLIENT_NODE_ID = "client_node";
-    public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, "127.0.0.1", null, null,
null, null, null, null);
+    public static final String CLUSTER_IP = "127.0.0.1";
+    public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, CLUSTER_IP, null, null,
null, null, null, null);
 
     private static String eventsDir;
-    private static Events events;
     private static Map<String, String> env = new HashMap<String, String>();
     private static String scriptDirSuffix;
 
-    public static String getEventsDir() {
-        return eventsDir;
-    }
-
-    public static Events getEvents() {
-        return events;
-    }
-
     public static Map<String, String> getEnvironment() {
         return env;
     }
 
-    public static String getStringifiedEnv(Cluster cluster) {
-        StringBuffer buffer = new StringBuffer();
-        for (Property p : cluster.getEnv().getProperty()) {
-            buffer.append(p.getKey() + "=" + p.getValue() + " ");
-        }
-        return buffer.toString();
-    }
-
     public static Cluster initializeCluster(String path) throws JAXBException, IOException
{
         Cluster cluster = EventUtil.getCluster(path);
         for (Property p : cluster.getEnv().getProperty()) {
@@ -76,17 +60,6 @@ public class EventDriver {
         return cluster;
     }
 
-    public static Patterns initializePatterns(String path) throws JAXBException, IOException
{
-        File file = new File(path);
-        JAXBContext ctx = JAXBContext.newInstance(Patterns.class);
-        Unmarshaller unmarshaller = ctx.createUnmarshaller();
-        return (Patterns) unmarshaller.unmarshal(file);
-    }
-
-    private static void initialize(EventConfig eventConfig) throws IOException, JAXBException
{
-
-    }
-
     public static void main(String[] args) throws Exception {
         String eventsHome = System.getenv("EVENT_HOME");
         if (eventsHome == null) {
@@ -104,14 +77,10 @@ public class EventDriver {
                 Randomizer.getInstance(eventConfig.seed);
             }
             Cluster cluster = initializeCluster(eventConfig.clusterPath);
-            initialize(eventConfig);
 
             if (!eventConfig.dryRun) {
                 prepare(cluster);
             }
-            //AsterixEventServiceClient client = new AsterixEventServiceClient(eventsDir,
cluster, eventConfig.dryRun,
-            //      new DefaultOutputHandler());
-            // client.submit(patterns);
             if (!eventConfig.dryRun) {
                 cleanup(cluster);
             }
@@ -123,12 +92,12 @@ public class EventDriver {
 
     private static void prepare(Cluster cluster) throws IOException, InterruptedException
{
 
-        scriptDirSuffix = "" + System.nanoTime();
+        scriptDirSuffix = Long.toString(System.nanoTime());
         List<String> args = new ArrayList<String>();
         args.add(scriptDirSuffix);
         Node clientNode = new Node();
         clientNode.setId("client");
-        clientNode.setClusterIp("127.0.0.1");
+        clientNode.setClusterIp(CLUSTER_IP);
         for (Node node : cluster.getNode()) {
             args.add(node.getClusterIp());
         }
@@ -140,7 +109,7 @@ public class EventDriver {
         args.add(scriptDirSuffix);
         Node clientNode = new Node();
         clientNode.setId("client");
-        clientNode.setClusterIp("127.0.0.1");
+        clientNode.setClusterIp(CLUSTER_IP);
         for (Node node : cluster.getNode()) {
             args.add(node.getClusterIp());
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
index 68e87c6..efb2ac4 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
@@ -41,7 +41,7 @@ public class OutputHandler implements IOutputHandler {
         EventType eventType = EventType.valueOf(event.getType().toUpperCase());
         boolean ignore = true;
         String trimmedOutput = output.trim();
-        StringBuffer errorMessage = new StringBuffer();
+        StringBuilder errorMessage = new StringBuilder();
         switch (eventType) {
             case FILE_TRANSFER:
                 if (trimmedOutput.length() > 0) {
@@ -57,14 +57,9 @@ public class OutputHandler implements IOutputHandler {
                 if (trimmedOutput.length() > 0) {
                     if (trimmedOutput.contains("AccessControlException")) {
                         errorMessage.append("Insufficient permissions on back up directory");
-                        ignore = false;
-                    }
-                    if (output.contains("does not exist") || output.contains("File exist")
-                            || (output.contains("No such file or directory"))) {
-                        ignore = true;
-                    } else {
-                        ignore = false;
                     }
+                    ignore = output.contains("does not exist") || output.contains("File exist")
+                            || (output.contains("No such file or directory"));
                 }
                 break;
 
@@ -87,10 +82,6 @@ public class OutputHandler implements IOutputHandler {
             default:
                 break;
         }
-        if (ignore) {
-            return new OutputAnalysis(true, null);
-        } else {
-            return new OutputAnalysis(false, errorMessage.toString());
-        }
+        return ignore ? new OutputAnalysis(true, null) : new OutputAnalysis(false, errorMessage.toString());
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
index 71efa44..640422e 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
@@ -51,7 +51,6 @@ public class VerificationUtil {
         boolean ccRunning = true;
         List<String> failedNCs = new ArrayList<String>();
         String[] infoFields;
-        ProcessInfo pInfo;
         List<ProcessInfo> processes = new ArrayList<ProcessInfo>();
 
         for (String line : output.split("\n")) {
@@ -64,8 +63,7 @@ public class VerificationUtil {
                 } else {
                     nodeid = instance.getCluster().getMasterNode().getId();
                 }
-                pInfo = new ProcessInfo(infoFields[0], infoFields[1], nodeid, pid);
-                processes.add(pInfo);
+                processes.add(new ProcessInfo(infoFields[0], infoFields[1], nodeid, pid));
             } catch (Exception e) {
                 if (infoFields[0].equalsIgnoreCase("CC")) {
                     ccRunning = false;
@@ -79,11 +77,11 @@ public class VerificationUtil {
 
     public static void updateInstanceWithRuntimeDescription(AsterixInstance instance, AsterixRuntimeState
state,
             boolean expectedRunning) {
-        StringBuffer summary = new StringBuffer();
+        StringBuilder summary = new StringBuilder();
         if (expectedRunning) {
             if (!state.isCcRunning()) {
-                summary.append("Cluster Controller not running at " + instance.getCluster().getMasterNode().getId()
-                        + "\n");
+                summary.append(
+                        "Cluster Controller not running at " + instance.getCluster().getMasterNode().getId()
+ "\n");
                 instance.setState(State.UNUSABLE);
             }
             if (state.getFailedNCs() != null && !state.getFailedNCs().isEmpty())
{
@@ -113,7 +111,7 @@ public class VerificationUtil {
 
     public static void verifyBackupRestoreConfiguration(String hdfsUrl, String hadoopVersion,
String hdfsBackupDir)
             throws Exception {
-        StringBuffer errorCheck = new StringBuffer();
+        StringBuilder errorCheck = new StringBuilder();
         if (hdfsUrl == null || hdfsUrl.length() == 0) {
             errorCheck.append("\n HDFS Url not configured");
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
index af33f2e..34c1837 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
@@ -196,8 +196,7 @@ public class AsterixEventServiceClient {
 
             }
         }
-        Patterns patterns = new Patterns(patternList);
-        return patterns;
+        return new Patterns(patternList);
     }
 
     private Pattern getDirectoryTransferPattern(String username, String src, Nodeid srcNode,
String destNodeIp,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/DefaultOutputHandler.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/DefaultOutputHandler.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/DefaultOutputHandler.java
deleted file mode 100644
index 907a494..0000000
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/DefaultOutputHandler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.event.management;
-
-import org.apache.asterix.event.schema.pattern.Event;
-
-public class DefaultOutputHandler implements IOutputHandler {
-
-    @Override
-    public OutputAnalysis reportEventOutput(Event event, String output) {
-        return new OutputAnalysis(true, null);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/ErrorHandler.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/ErrorHandler.java
deleted file mode 100644
index fb2d1b7..0000000
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/ErrorHandler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.event.management;
-
-public class ErrorHandler {
-
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
index 4587756..ebeea63 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
@@ -35,7 +35,6 @@ import org.apache.commons.io.IOUtils;
 
 public class EventExecutor {
 
-    public static final String EVENTS_DIR = "events";
     private static final String EXECUTE_SCRIPT = "execute.sh";
     private static final String IP_LOCATION = "IP_LOCATION";
     private static final String CLUSTER_ENV = "ENV";
@@ -49,7 +48,7 @@ public class EventExecutor {
         pargs.add("/bin/bash");
         pargs.add(client.getEventsHomeDir() + File.separator + AsterixEventServiceUtil.EVENT_DIR
+ File.separator
                 + EXECUTE_SCRIPT);
-        StringBuffer envBuffer = new StringBuffer(IP_LOCATION + "=" + node.getClusterIp()
+ " ");
+        StringBuilder envBuffer = new StringBuilder(IP_LOCATION + "=" + node.getClusterIp()
+ " ");
         boolean isMasterNode = node.getId().equals(cluster.getMasterNode().getId());
 
         if (!node.getId().equals(EventDriver.CLIENT_NODE_ID) && cluster.getEnv()
!= null) {
@@ -59,41 +58,11 @@ public class EventExecutor {
                     envBuffer.append(p.getKey() + "=" + val + " ");
                 } else if (p.getKey().equals(EventUtil.NC_JAVA_OPTS)) {
                     if (!isMasterNode) {
-                        StringBuilder builder = new StringBuilder();
-                        builder.append("\"");
-                        String javaOpts = p.getValue();
-                        if (javaOpts != null) {
-                            builder.append(javaOpts);
-                        }
-                        if (node.getDebugPort() != null) {
-                            int debugPort = node.getDebugPort().intValue();
-                            if (!javaOpts.contains("-Xdebug")) {
-                                builder.append(
-                                        (" " + "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address="
-                                                + debugPort));
-                            }
-                        }
-                        builder.append("\"");
-                        envBuffer.append("JAVA_OPTS" + "=" + builder + " ");
+                        appendJavaOpts(node, envBuffer, p);
                     }
                 } else if (p.getKey().equals(EventUtil.CC_JAVA_OPTS)) {
                     if (isMasterNode) {
-                        StringBuilder builder = new StringBuilder();
-                        builder.append("\"");
-                        String javaOpts = p.getValue();
-                        if (javaOpts != null) {
-                            builder.append(javaOpts);
-                        }
-                        if (node.getDebugPort() != null) {
-                            int debugPort = node.getDebugPort().intValue();
-                            if (!javaOpts.contains("-Xdebug")) {
-                                builder.append(
-                                        (" " + "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address="
-                                                + debugPort));
-                            }
-                        }
-                        builder.append("\"");
-                        envBuffer.append("JAVA_OPTS" + "=" + builder + " ");
+                        appendJavaOpts(node, envBuffer, p);
                     }
                 } else if (p.getKey().equals("LOG_DIR")) {
                     String val = node.getLogDir() == null ? p.getValue() : node.getLogDir();
@@ -106,7 +75,7 @@ public class EventExecutor {
             pargs.add(cluster.getUsername() == null ? System.getProperty("user.name") : cluster.getUsername());
         }
 
-        StringBuffer argBuffer = new StringBuffer();
+        StringBuilder argBuffer = new StringBuilder();
         if (args != null && args.size() > 0) {
             for (String arg : args) {
                 argBuffer.append(arg + " ");
@@ -118,7 +87,7 @@ public class EventExecutor {
         pb.environment().put(CLUSTER_ENV, envBuffer.toString());
         pb.environment().put(SCRIPT, script);
         pb.environment().put(ARGS, argBuffer.toString());
-        pb.environment().put(DAEMON, isDaemon ? "true" : "false");
+        pb.environment().put(DAEMON, Boolean.toString(isDaemon));
 
         Process p = pb.start();
         if (!isDaemon) {
@@ -132,4 +101,21 @@ public class EventExecutor {
             }
         }
     }
+
+    protected void appendJavaOpts(Node node, StringBuilder envBuffer, Property p) {
+        StringBuilder builder = new StringBuilder();
+        builder.append("\"");
+        String javaOpts = p.getValue();
+        if (javaOpts != null) {
+            builder.append(javaOpts);
+        }
+        if (node.getDebugPort() != null) {
+            int debugPort = node.getDebugPort().intValue();
+            if (javaOpts == null || !javaOpts.contains("-Xdebug")) {
+                builder.append(" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=").append(debugPort);
+            }
+        }
+        builder.append("\"");
+        envBuffer.append("JAVA_OPTS=").append(builder.toString()).append(" ");
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
index e0e5bc4..29b855d 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
@@ -143,10 +143,6 @@ public class EventTask extends TimerTask {
         return interval;
     }
 
-    public long getInitialDelay() {
-        return initialDelay;
-    }
-
     public Pattern getPattern() {
         return pattern;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
index 57648b8..55e0780 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
@@ -41,17 +41,11 @@ import org.apache.asterix.event.schema.pattern.Pattern;
 public class EventUtil {
 
     public static final String EVENTS_DIR = "events";
-    public static final String CLUSTER_CONF = "config/cluster.xml";
-    public static final String PATTERN_CONF = "config/pattern.xml";
     public static final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
     public static final String NC_JAVA_OPTS = "nc.java.opts";
     public static final String CC_JAVA_OPTS = "cc.java.opts";
 
     private static final String IP_LOCATION = "IP_LOCATION";
-    private static final String CLUSTER_ENV = "ENV";
-    private static final String SCRIPT = "SCRIPT";
-    private static final String ARGS = "ARGS";
-    private static final String EXECUTE_SCRIPT = "events/execute.sh";
 
     public static Cluster getCluster(String clusterConfigurationPath) throws JAXBException
{
         File file = new File(clusterConfigurationPath);
@@ -201,7 +195,7 @@ public class EventUtil {
                 return node;
             }
         }
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append(EventDriver.CLIENT_NODE.getId() + ",");
         buffer.append(cluster.getMasterNode().getId() + ",");
         for (Node v : cluster.getNode()) {
@@ -211,27 +205,6 @@ public class EventUtil {
         throw new IllegalArgumentException("Unknown node id :" + nodeid + " valid ids:" +
buffer);
     }
 
-    public static void executeEventScript(Node node, String script, List<String> args,
Cluster cluster)
-            throws IOException, InterruptedException {
-        List<String> pargs = new ArrayList<String>();
-        pargs.add("/bin/bash");
-        pargs.add(EventDriver.getEventsDir() + "/" + EXECUTE_SCRIPT);
-        StringBuffer argBuffer = new StringBuffer();
-        String env = EventDriver.getStringifiedEnv(cluster) + " " + IP_LOCATION + "=" + node.getClusterIp();
-        if (args != null) {
-            for (String arg : args) {
-                argBuffer.append(arg + " ");
-            }
-        }
-        ProcessBuilder pb = new ProcessBuilder(pargs);
-        pb.environment().putAll(EventDriver.getEnvironment());
-        pb.environment().put(IP_LOCATION, node.getClusterIp());
-        pb.environment().put(CLUSTER_ENV, env);
-        pb.environment().put(SCRIPT, script);
-        pb.environment().put(ARGS, argBuffer.toString());
-        pb.start();
-    }
-
     public static void executeLocalScript(Node node, String script, List<String> args)
throws IOException,
             InterruptedException {
         List<String> pargs = new ArrayList<String>();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
index e6c6986..f824d5b 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
@@ -66,10 +66,6 @@ public class AsterixInstance implements Serializable {
         this.backupInfo = new ArrayList<BackupInfo>();
     }
 
-    public Date getModifiedTimestamp() {
-        return stateChangeTimestamp;
-    }
-
     public State getState() {
         return state;
     }
@@ -87,14 +83,6 @@ public class AsterixInstance implements Serializable {
         return name;
     }
 
-    public Date getCreatedTimestamp() {
-        return createdTimestamp;
-    }
-
-    public Date getStateChangeTimestamp() {
-        return stateChangeTimestamp;
-    }
-
     public void setStateChangeTimestamp(Date stateChangeTimestamp) {
         this.stateChangeTimestamp = stateChangeTimestamp;
     }
@@ -112,7 +100,7 @@ public class AsterixInstance implements Serializable {
     }
 
     public String getDescription(boolean detailed) {
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append("Name:" + name + "\n");
         buffer.append("Created:" + createdTimestamp + "\n");
 
@@ -150,15 +138,11 @@ public class AsterixInstance implements Serializable {
         return "http://" + cluster.getMasterNode().getClientIp() + ":" + webPort;
     }
 
-    public AsterixRuntimeState getAsterixRuntimeState() {
-        return runtimeState;
-    }
-
     public void setAsterixRuntimeStates(AsterixRuntimeState runtimeState) {
         this.runtimeState = runtimeState;
     }
 
-    private void addDetailedInformation(StringBuffer buffer) {
+    private void addDetailedInformation(StringBuilder buffer) {
         buffer.append("Master node:" + cluster.getMasterNode().getId() + ":" + cluster.getMasterNode().getClusterIp()
                 + "\n");
         for (Node node : cluster.getNode()) {
@@ -196,7 +180,7 @@ public class AsterixInstance implements Serializable {
 
     private String getIndentation(String name, int lenMax) {
         int len = name.length();
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         for (int i = 0; i < lenMax - len; i++) {
             buf.append(" ");
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
index 38bb7a9..ae10cd7 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
@@ -58,7 +58,6 @@ public class BackupInfo implements Serializable {
     public String toString() {
         return id + " " + date + " " + "(" + getBackupType() + ")" + " " + "[ " + this.getBackupConf().getBackupDir()
                 + " ]";
-
     }
 
     public BackupType getBackupType() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
index f266b84..9702ceb 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
@@ -35,18 +35,10 @@ public class ProcessInfo implements Serializable {
         this.processId = processId;
     }
 
-    public String getProcessName() {
-        return processName;
-    }
-
     public String getHost() {
         return host;
     }
 
-    public int getProcessId() {
-        return processId;
-    }
-
     public String getNodeId() {
         return nodeId;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
index 55a9200..f95b934 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
@@ -21,13 +21,12 @@ package org.apache.asterix.event.service;
 import java.io.File;
 import java.io.FileFilter;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-
 import org.apache.asterix.event.error.OutputHandler;
 import org.apache.asterix.event.management.AsterixEventServiceClient;
 import org.apache.asterix.event.schema.cluster.Cluster;
 import org.apache.asterix.installer.schema.conf.Configuration;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 
 public class AsterixEventService {
 
@@ -46,15 +45,12 @@ public class AsterixEventService {
 
     public static AsterixEventServiceClient getAsterixEventServiceClient(Cluster cluster,
boolean transferArtifacts,
             boolean dryRun) throws Exception {
-        AsterixEventServiceClient client = new AsterixEventServiceClient(configuration, eventHome,
cluster,
-                transferArtifacts, dryRun, OutputHandler.INSTANCE);
-        return client;
+        return new AsterixEventServiceClient(configuration, eventHome, cluster, transferArtifacts,
dryRun,
+                OutputHandler.INSTANCE);
     }
 
     public static AsterixEventServiceClient getAsterixEventServiceClient(Cluster cluster)
throws Exception {
-        AsterixEventServiceClient client = new AsterixEventServiceClient(configuration, eventHome,
cluster, false,
-                false, OutputHandler.INSTANCE);
-        return client;
+        return new AsterixEventServiceClient(configuration, eventHome, cluster, false, false,
OutputHandler.INSTANCE);
     }
 
     private static String initBinary(final String fileNamePattern) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
index 02c06dc..9b22396 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
@@ -65,33 +65,25 @@ import org.apache.commons.io.IOUtils;
 public class AsterixEventServiceUtil {
 
     public static final String TXN_LOG_DIR = "txnLogs";
-    public static final String TXN_LOG_DIR_KEY_SUFFIX = "txnLogDir";
     public static final String ASTERIX_CONFIGURATION_FILE = "asterix-configuration.xml";
-    public static final String TXN_LOG_CONFIGURATION_FILE = "log.properties";
     public static final String CLUSTER_CONFIGURATION_FILE = "cluster.xml";
-    public static final String ASTERIX_DIR = "asterix";
     public static final String EVENT_DIR = "events";
-    public static final String DEFAULT_ASTERIX_CONFIGURATION_PATH = "conf" + File.separator
+ File.separator
-            + "asterix-configuration.xml";
     public static final int CLUSTER_NET_PORT_DEFAULT = 1098;
     public static final int CLIENT_NET_PORT_DEFAULT = 1099;
     public static final int HTTP_PORT_DEFAULT = 8888;
-    public static final int WEB_INTERFACE_PORT_DEFAULT = 19001;
 
-    public static final String MANAGIX_INTERNAL_DIR = ".installer";
     public static final String MANAGIX_CONF_XML = "conf" + File.separator + "managix-conf.xml";
 
     private static final int BUFFER_SIZE = 4096;
 
     public static AsterixInstance createAsterixInstance(String asterixInstanceName, Cluster
cluster,
-            AsterixConfiguration asterixConfiguration) throws FileNotFoundException, IOException
{
+            AsterixConfiguration asterixConfiguration) throws IOException {
         Node metadataNode = getMetadataNode(asterixInstanceName, cluster);
         String asterixZipName = asterixZipName();
         String asterixVersion = asterixZipName.substring("asterix-server-".length(),
                 asterixZipName.indexOf("-binary-assembly"));
-        AsterixInstance instance = new AsterixInstance(asterixInstanceName, cluster, asterixConfiguration,
+        return new AsterixInstance(asterixInstanceName, cluster, asterixConfiguration,
                 metadataNode.getId(), asterixVersion);
-        return instance;
     }
 
     public static void createAsterixZip(AsterixInstance asterixInstance)

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
index 7606a25..ab421fd 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
@@ -24,7 +24,6 @@ public class ServiceProvider {
     private static ILookupService lookupService = new ZooKeeperService();
 
     private ServiceProvider() {
-
     }
 
     public ILookupService getLookupService() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
index a10b5ea..ee80894 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
@@ -67,7 +67,7 @@ public class ZooKeeperService implements ILookupService {
     public boolean isRunning(Configuration conf) throws Exception {
         List<String> servers = conf.getZookeeper().getServers().getServer();
         int clientPort = conf.getZookeeper().getClientPort().intValue();
-        StringBuffer connectionString = new StringBuffer();
+        StringBuilder connectionString = new StringBuilder();
         for (String serverAddress : servers) {
             connectionString.append(serverAddress);
             connectionString.append(":");
@@ -101,7 +101,7 @@ public class ZooKeeperService implements ILookupService {
         ZookeeperUtil.writeConfiguration(ZOO_KEEPER_CONFIG, conf, ZOOKEEPER_LEADER_CONN_PORT,
                 ZOOKEEPER_LEADER_ELEC_PORT);
         String initScript = ZOOKEEPER_HOME + File.separator + "bin" + File.separator + "zk.init";
-        StringBuffer cmdBuffer = new StringBuffer();
+        StringBuilder cmdBuffer = new StringBuilder();
         cmdBuffer.append(initScript + " ");
         cmdBuffer.append(conf.getZookeeper().getHomeDir() + " ");
         cmdBuffer.append(conf.getZookeeper().getServers().getJavaHome() + " ");
@@ -137,7 +137,7 @@ public class ZooKeeperService implements ILookupService {
             LOGGER.debug("Stopping ZooKeeper running at " + zkConnectionString);
         }
         String stopScript = ZOOKEEPER_HOME + File.separator + "bin" + File.separator + "stop_zk";
-        StringBuffer cmdBuffer = new StringBuffer();
+        StringBuilder cmdBuffer = new StringBuilder();
         cmdBuffer.append(stopScript + " ");
         cmdBuffer.append(conf.getZookeeper().getHomeDir() + " ");
         List<String> zkServers = conf.getZookeeper().getServers().getServer();
@@ -282,7 +282,7 @@ class ZookeeperUtil {
     public static void writeConfiguration(String zooKeeperConfigPath, Configuration conf,
int leaderConnPort,
             int leaderElecPort) throws IOException {
 
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append("tickTime=1000" + "\n");
         buffer.append("dataDir=" + conf.getZookeeper().getHomeDir() + File.separator + "data"
+ "\n");
         buffer.append("clientPort=" + conf.getZookeeper().getClientPort().intValue() + "\n");

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
index 1780a51..9c6725b 100644
--- a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
+++ b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
@@ -54,8 +54,6 @@ public class PatternCreator {
     private PatternCreator() {
     }
 
-    private ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
-
     private void addInitialDelay(Pattern p, int delay, String unit) {
         Delay d = new Delay(new Value(null, Integer.toString(delay)), unit);
         p.setDelay(d);
@@ -102,26 +100,6 @@ public class PatternCreator {
         return new Patterns(ps);
     }
 
-    public Patterns getStopCommandPattern(String asterixInstanceName) throws Exception {
-        List<Pattern> ps = new ArrayList<>();
-        AsterixInstance asterixInstance = lookupService.getAsterixInstance(asterixInstanceName);
-        Cluster cluster = asterixInstance.getCluster();
-
-        String ccLocation = cluster.getMasterNode().getId();
-        Pattern createCC = createCCStopPattern(ccLocation);
-        addInitialDelay(createCC, 5, "sec");
-        ps.add(createCC);
-
-        int nodeControllerIndex = 1;
-        for (Node node : cluster.getNode()) {
-            Pattern createNC = createNCStopPattern(node.getId(), asterixInstanceName + "_"
+ nodeControllerIndex);
-            ps.add(createNC);
-            nodeControllerIndex++;
-        }
-
-        return new Patterns(ps);
-    }
-
     public Patterns getBackUpAsterixPattern(AsterixInstance instance, Backup backupConf)
throws Exception {
         BackupType backupType = BackupInfo.getBackupType(backupConf);
         Patterns patterns = null;
@@ -600,7 +578,7 @@ public class PatternCreator {
         return new Patterns(ps);
     }
 
-    public Patterns getGenerateLogPattern(String asterixInstanceName, Cluster cluster, String
outputDir) {
+    public Patterns getGenerateLogPattern(Cluster cluster, String outputDir) {
         List<Pattern> patternList = new ArrayList<>();
         Map<String, String> nodeLogs = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/397de7e9/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
b/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
index b4ea96b..1e00d70 100644
--- a/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
+++ b/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
@@ -58,7 +58,7 @@ public class LogCommand extends AbstractCommand {
                 throw new InstallerException("Unable to create output directory:" + outputDirPath);
             }
         }
-        Patterns transferLogPattern = pc.getGenerateLogPattern(asterixInstanceName, instance.getCluster(),
+        Patterns transferLogPattern = pc.getGenerateLogPattern(instance.getCluster(),
                 outputDirPath);
         eventrixClient.submit(transferLogPattern);
         File outputDirFile = new File(outputDirPath);


Mime
View raw message