helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject [40/51] [partial] [HELIX-198] Unify helix code style, rb=13710
Date Wed, 21 Aug 2013 20:43:53 GMT
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java b/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java
index 2a48d6a..f1b37fc 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java
@@ -34,43 +34,36 @@ import org.apache.helix.participant.statemachine.StateModelFactory;
 import org.apache.helix.participant.statemachine.StateModelInfo;
 import org.apache.helix.participant.statemachine.Transition;
 
-
-public class BootstrapHandler extends StateModelFactory<StateModel>
-{
+public class BootstrapHandler extends StateModelFactory<StateModel> {
 
   @Override
-  public StateModel createNewStateModel(String stateUnitKey)
-  {
+  public StateModel createNewStateModel(String stateUnitKey) {
     return new BootstrapStateModel(stateUnitKey);
   }
 
   @StateModelInfo(initialState = "OFFLINE", states = "{'OFFLINE','SLAVE','MASTER'}")
-  public static class BootstrapStateModel extends StateModel
-  {
+  public static class BootstrapStateModel extends StateModel {
 
     private final String _stateUnitKey;
 
-    public BootstrapStateModel(String stateUnitKey)
-    {
+    public BootstrapStateModel(String stateUnitKey) {
       _stateUnitKey = stateUnitKey;
 
     }
+
     @Transition(from = "MASTER", to = "SLAVE")
-    public void masterToSlave(Message message, NotificationContext context)
-    {
-      
+    public void masterToSlave(Message message, NotificationContext context) {
+
     }
+
     @Transition(from = "OFFLINE", to = "SLAVE")
-    public void offlineToSlave(Message message, NotificationContext context)
-    {
-      System.out
-          .println("BootstrapProcess.BootstrapStateModel.offlineToSlave()");
+    public void offlineToSlave(Message message, NotificationContext context) {
+      System.out.println("BootstrapProcess.BootstrapStateModel.offlineToSlave()");
       HelixManager manager = context.getManager();
       ClusterMessagingService messagingService = manager.getMessagingService();
-      Message requestBackupUriRequest = new Message(
-          MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
-      requestBackupUriRequest
-          .setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
+      Message requestBackupUriRequest =
+          new Message(MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
+      requestBackupUriRequest.setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
       requestBackupUriRequest.setMsgState(MessageState.NEW);
       Criteria recipientCriteria = new Criteria();
       recipientCriteria.setInstanceName("*");
@@ -82,35 +75,31 @@ public class BootstrapHandler extends StateModelFactory<StateModel>
       int timeout = 30000;
       BootstrapReplyHandler responseHandler = new BootstrapReplyHandler();
 
-      int sentMessageCount = messagingService.sendAndWait(recipientCriteria,
-          requestBackupUriRequest, responseHandler, timeout);
-      if (sentMessageCount == 0)
-      {
+      int sentMessageCount =
+          messagingService.sendAndWait(recipientCriteria, requestBackupUriRequest, responseHandler,
+              timeout);
+      if (sentMessageCount == 0) {
         // could not find any other node hosting the partition
-      } else if (responseHandler.getBootstrapUrl() != null)
-      {
-        System.out.println("Got bootstrap url:"+ responseHandler.getBootstrapUrl() );
-        System.out.println("Got backup time:"+ responseHandler.getBootstrapTime() );
+      } else if (responseHandler.getBootstrapUrl() != null) {
+        System.out.println("Got bootstrap url:" + responseHandler.getBootstrapUrl());
+        System.out.println("Got backup time:" + responseHandler.getBootstrapTime());
         // Got the url fetch it
-      } else
-      {
+      } else {
         // Either go to error state
         // throw new Exception("Cant find backup/bootstrap data");
         // Request some node to start backup process
       }
     }
+
     @Transition(from = "SLAVE", to = "OFFLINE")
-    public void slaveToOffline(Message message, NotificationContext context)
-    {
-      System.out
-          .println("BootstrapProcess.BootstrapStateModel.slaveToOffline()");
+    public void slaveToOffline(Message message, NotificationContext context) {
+      System.out.println("BootstrapProcess.BootstrapStateModel.slaveToOffline()");
     }
+
     @Transition(from = "SLAVE", to = "MASTER")
-    public void slaveToMaster(Message message, NotificationContext context)
-    {
-      System.out
-          .println("BootstrapProcess.BootstrapStateModel.slaveToMaster()");
+    public void slaveToMaster(Message message, NotificationContext context) {
+      System.out.println("BootstrapProcess.BootstrapStateModel.slaveToMaster()");
     }
 
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/BootstrapProcess.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/BootstrapProcess.java b/helix-core/src/main/java/org/apache/helix/examples/BootstrapProcess.java
index 8d5be5c..73f1175 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/BootstrapProcess.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/BootstrapProcess.java
@@ -1,5 +1,5 @@
-
 package org.apache.helix.examples;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -47,7 +47,6 @@ import org.apache.helix.participant.statemachine.StateModel;
 import org.apache.helix.participant.statemachine.StateModelFactory;
 import org.apache.helix.tools.ClusterStateVerifier;
 
-
 /**
  * This process does little more than handling the state transition messages.
  * This is generally the case when the server needs to bootstrap when it comes
@@ -56,18 +55,15 @@ import org.apache.helix.tools.ClusterStateVerifier;
  * <ul>
  * <li>Gets OFFLINE-SLAVE transition</li>
  * <li>Figure out if it has any data and how old it is for the SLAVE partition</li>
- * <li>If the data is fresh enough it can probably catch up from the replication
- * stream of the master</li>
- * <li>If not, then it can use the messaging service provided by cluster manager
- * to talk other nodes to figure out if they have any backup</li>
- * </li>
- * <li>Once it gets a response from other nodes in the cluster the process can
- * decide which back up it wants to use to bootstrap</li>
+ * <li>If the data is fresh enough it can probably catch up from the replication stream of the
+ * master</li>
+ * <li>If not, then it can use the messaging service provided by cluster manager to talk other nodes
+ * to figure out if they have any backup</li> </li>
+ * <li>Once it gets a response from other nodes in the cluster the process can decide which back up
+ * it wants to use to bootstrap</li>
  * </ul>
- *
  */
-public class BootstrapProcess
-{
+public class BootstrapProcess {
   static final String REQUEST_BOOTSTRAP_URL = "REQUEST_BOOTSTRAP_URL";
   public static final String zkServer = "zkSvr";
   public static final String cluster = "cluster";
@@ -85,15 +81,14 @@ public class BootstrapProcess
   private final String stateModelType;
   private HelixManager manager;
 
-//  private StateMachineEngine genericStateMachineHandler;
+  // private StateMachineEngine genericStateMachineHandler;
 
   private String _file = null;
   private StateModelFactory<StateModel> stateModelFactory;
   private final int delay;
 
-  public BootstrapProcess(String zkConnectString, String clusterName,
-      String instanceName, String stateModel, int delay)
-  {
+  public BootstrapProcess(String zkConnectString, String clusterName, String instanceName,
+      String stateModel, int delay) {
     this.zkConnectString = zkConnectString;
     this.clusterName = clusterName;
     this.instanceName = instanceName;
@@ -101,88 +96,68 @@ public class BootstrapProcess
     this.delay = delay;
   }
 
-  public void start() throws Exception
-  {
-      manager = HelixManagerFactory.getZKHelixManager(clusterName,
-                                                          instanceName,
-                                                          InstanceType.PARTICIPANT,
-                                                          zkConnectString);
+  public void start() throws Exception {
+    manager =
+        HelixManagerFactory.getZKHelixManager(clusterName, instanceName, InstanceType.PARTICIPANT,
+            zkConnectString);
 
-    
     stateModelFactory = new BootstrapHandler();
-//    genericStateMachineHandler = new StateMachineEngine();
-//    genericStateMachineHandler.registerStateModelFactory("MasterSlave", stateModelFactory);
-    
+    // genericStateMachineHandler = new StateMachineEngine();
+    // genericStateMachineHandler.registerStateModelFactory("MasterSlave", stateModelFactory);
+
     StateMachineEngine stateMach = manager.getStateMachineEngine();
     stateMach.registerStateModelFactory("MasterSlave", stateModelFactory);
-    
+
     manager.getMessagingService().registerMessageHandlerFactory(
         MessageType.STATE_TRANSITION.toString(), stateMach);
     manager.getMessagingService().registerMessageHandlerFactory(
-        MessageType.USER_DEFINE_MSG.toString(),
-        new CustomMessageHandlerFactory());
+        MessageType.USER_DEFINE_MSG.toString(), new CustomMessageHandlerFactory());
     manager.connect();
   }
 
-  public static class CustomMessageHandlerFactory implements
-      MessageHandlerFactory
-  {
+  public static class CustomMessageHandlerFactory implements MessageHandlerFactory {
 
     @Override
-    public MessageHandler createHandler(Message message,
-        NotificationContext context)
-    {
+    public MessageHandler createHandler(Message message, NotificationContext context) {
 
       return new CustomMessageHandler(message, context);
     }
 
     @Override
-    public String getMessageType()
-    {
+    public String getMessageType() {
       return MessageType.USER_DEFINE_MSG.toString();
     }
 
     @Override
-    public void reset()
-    {
+    public void reset() {
 
     }
 
-    static class CustomMessageHandler extends MessageHandler
-    {
+    static class CustomMessageHandler extends MessageHandler {
 
-      public CustomMessageHandler(Message message, NotificationContext context)
-      {
+      public CustomMessageHandler(Message message, NotificationContext context) {
         super(message, context);
         // TODO Auto-generated constructor stub
       }
 
       @Override
-      public HelixTaskResult handleMessage() throws InterruptedException
-      {
+      public HelixTaskResult handleMessage() throws InterruptedException {
         String hostName;
         HelixTaskResult result = new HelixTaskResult();
-        try
-        {
+        try {
           hostName = InetAddress.getLocalHost().getCanonicalHostName();
-        } catch (UnknownHostException e)
-        {
+        } catch (UnknownHostException e) {
           hostName = "UNKNOWN";
         }
         String port = "2134";
         String msgSubType = _message.getMsgSubType();
-        if (msgSubType.equals(REQUEST_BOOTSTRAP_URL))
-        {
+        if (msgSubType.equals(REQUEST_BOOTSTRAP_URL)) {
           result.getTaskResultMap().put(
               "BOOTSTRAP_URL",
-              "http://" + hostName + ":" + port
-                  + "/getFile?path=/data/bootstrap/"
-                  + _message.getResourceName() + "/"
-                  + _message.getPartitionName() + ".tar");
+              "http://" + hostName + ":" + port + "/getFile?path=/data/bootstrap/"
+                  + _message.getResourceName() + "/" + _message.getPartitionName() + ".tar");
 
-          result.getTaskResultMap().put(
-              "BOOTSTRAP_TIME",
-              ""+new Date().getTime());
+          result.getTaskResultMap().put("BOOTSTRAP_TIME", "" + new Date().getTime());
         }
 
         result.setSuccess(true);
@@ -190,59 +165,58 @@ public class BootstrapProcess
       }
 
       @Override
-      public void onError( Exception e, ErrorCode code, ErrorType type)
-      {
+      public void onError(Exception e, ErrorCode code, ErrorType type) {
         e.printStackTrace();
       }
     }
   }
 
-
   @SuppressWarnings("static-access")
-  private static Options constructCommandLineOptions()
-  {
-    Option helpOption = OptionBuilder.withLongOpt(help)
-        .withDescription("Prints command-line options info").create();
+  private static Options constructCommandLineOptions() {
+    Option helpOption =
+        OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info")
+            .create();
 
-    Option zkServerOption = OptionBuilder.withLongOpt(zkServer)
-        .withDescription("Provide zookeeper address").create();
+    Option zkServerOption =
+        OptionBuilder.withLongOpt(zkServer).withDescription("Provide zookeeper address").create();
     zkServerOption.setArgs(1);
     zkServerOption.setRequired(true);
     zkServerOption.setArgName("ZookeeperServerAddress(Required)");
 
-    Option clusterOption = OptionBuilder.withLongOpt(cluster)
-        .withDescription("Provide cluster name").create();
+    Option clusterOption =
+        OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create();
     clusterOption.setArgs(1);
     clusterOption.setRequired(true);
     clusterOption.setArgName("Cluster name (Required)");
 
-    Option hostOption = OptionBuilder.withLongOpt(hostAddress)
-        .withDescription("Provide host name").create();
+    Option hostOption =
+        OptionBuilder.withLongOpt(hostAddress).withDescription("Provide host name").create();
     hostOption.setArgs(1);
     hostOption.setRequired(true);
     hostOption.setArgName("Host name (Required)");
 
-    Option portOption = OptionBuilder.withLongOpt(hostPort)
-        .withDescription("Provide host port").create();
+    Option portOption =
+        OptionBuilder.withLongOpt(hostPort).withDescription("Provide host port").create();
     portOption.setArgs(1);
     portOption.setRequired(true);
     portOption.setArgName("Host port (Required)");
 
-    Option stateModelOption = OptionBuilder.withLongOpt(stateModel)
-        .withDescription("StateModel Type").create();
+    Option stateModelOption =
+        OptionBuilder.withLongOpt(stateModel).withDescription("StateModel Type").create();
     stateModelOption.setArgs(1);
     stateModelOption.setRequired(true);
     stateModelOption.setArgName("StateModel Type (Required)");
 
     // add an option group including either --zkSvr or --configFile
-    Option fileOption = OptionBuilder.withLongOpt(configFile)
-        .withDescription("Provide file to read states/messages").create();
+    Option fileOption =
+        OptionBuilder.withLongOpt(configFile)
+            .withDescription("Provide file to read states/messages").create();
     fileOption.setArgs(1);
     fileOption.setRequired(true);
     fileOption.setArgName("File to read states/messages (Optional)");
 
-    Option transDelayOption = OptionBuilder.withLongOpt(transDelay)
-        .withDescription("Provide state trans delay").create();
+    Option transDelayOption =
+        OptionBuilder.withLongOpt(transDelay).withDescription("Provide state trans delay").create();
     transDelayOption.setArgs(1);
     transDelayOption.setRequired(false);
     transDelayOption.setArgName("Delay time in state transition, in MS");
@@ -265,41 +239,33 @@ public class BootstrapProcess
     return options;
   }
 
-  public static void printUsage(Options cliOptions)
-  {
+  public static void printUsage(Options cliOptions) {
     HelpFormatter helpFormatter = new HelpFormatter();
     helpFormatter.printHelp("java " + BootstrapProcess.class.getName(), cliOptions);
   }
 
-  public static CommandLine processCommandLineArgs(String[] cliArgs)
-      throws Exception
-  {
+  public static CommandLine processCommandLineArgs(String[] cliArgs) throws Exception {
     CommandLineParser cliParser = new GnuParser();
     Options cliOptions = constructCommandLineOptions();
-    try
-    {
+    try {
       return cliParser.parse(cliOptions, cliArgs);
-    } catch (ParseException pe)
-    {
-      System.err
-          .println("CommandLineClient: failed to parse command-line options: "
-              + pe.toString());
+    } catch (ParseException pe) {
+      System.err.println("CommandLineClient: failed to parse command-line options: "
+          + pe.toString());
       printUsage(cliOptions);
       System.exit(1);
     }
     return null;
   }
 
-  public static void main(String[] args) throws Exception
-  {
+  public static void main(String[] args) throws Exception {
     String zkConnectString = "localhost:2181";
     String clusterName = "storage-integration-cluster";
     String instanceName = "localhost_8905";
     String stateModelValue = "MasterSlave";
     int delay = 0;
     boolean skipZeroArgs = true;// false is for dev testing
-    if (!skipZeroArgs || args.length > 0)
-    {
+    if (!skipZeroArgs || args.length > 0) {
       CommandLine cmd = processCommandLineArgs(args);
       zkConnectString = cmd.getOptionValue(zkServer);
       clusterName = cmd.getOptionValue(cluster);
@@ -309,19 +275,14 @@ public class BootstrapProcess
       int port = Integer.parseInt(portString);
       instanceName = host + "_" + port;
 
-
       stateModelValue = cmd.getOptionValue(stateModel);
-      if (cmd.hasOption(transDelay))
-      {
-        try
-        {
+      if (cmd.hasOption(transDelay)) {
+        try {
           delay = Integer.parseInt(cmd.getOptionValue(transDelay));
-          if (delay < 0)
-          {
+          if (delay < 0) {
             throw new Exception("delay must be positive");
           }
-        } catch (Exception e)
-        {
+        } catch (Exception e) {
           e.printStackTrace();
           delay = 0;
         }
@@ -330,46 +291,39 @@ public class BootstrapProcess
     // Espresso_driver.py will consume this
     System.out.println("Starting Process with ZK:" + zkConnectString);
 
-    BootstrapProcess process = new BootstrapProcess(zkConnectString,
-        clusterName, instanceName, stateModelValue, delay);
+    BootstrapProcess process =
+        new BootstrapProcess(zkConnectString, clusterName, instanceName, stateModelValue, delay);
 
     process.start();
     Thread.currentThread().join();
   }
 }
 
-class BootstrapReplyHandler extends AsyncCallback
-{
+class BootstrapReplyHandler extends AsyncCallback {
 
-  public BootstrapReplyHandler()
-  {
+  public BootstrapReplyHandler() {
   }
 
   private String bootstrapUrl;
   private String bootstrapTime;
 
   @Override
-  public void onTimeOut()
-  {
+  public void onTimeOut() {
     System.out.println("Timed out");
   }
 
-  public String getBootstrapUrl()
-  {
+  public String getBootstrapUrl() {
     return bootstrapUrl;
   }
 
-  public String getBootstrapTime()
-  {
+  public String getBootstrapTime() {
     return bootstrapTime;
   }
 
   @Override
-  public void onReplyMessage(Message message)
-  {
+  public void onReplyMessage(Message message) {
     String time = message.getResultMap().get("BOOTSTRAP_TIME");
-    if (bootstrapTime == null || time.compareTo(bootstrapTime) > -1)
-    {
+    if (bootstrapTime == null || time.compareTo(bootstrapTime) > -1) {
       bootstrapTime = message.getResultMap().get("BOOTSTRAP_TIME");
       bootstrapUrl = message.getResultMap().get("BOOTSTRAP_URL");
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java b/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java
index 6bf1500..52a3696 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java
@@ -30,82 +30,71 @@ import org.apache.helix.participant.statemachine.StateModelFactory;
 import org.apache.helix.participant.statemachine.StateModelInfo;
 import org.apache.helix.participant.statemachine.Transition;
 
-public class DummyParticipant
-{
+public class DummyParticipant {
   // dummy master-slave state model
-  @StateModelInfo(initialState = "OFFLINE", states = { "MASTER", "SLAVE", "ERROR" })
-  public static class DummyMSStateModel extends StateModel
-  {
+  @StateModelInfo(initialState = "OFFLINE", states = {
+      "MASTER", "SLAVE", "ERROR"
+  })
+  public static class DummyMSStateModel extends StateModel {
     @Transition(to = "SLAVE", from = "OFFLINE")
-    public void onBecomeSlaveFromOffline(Message message, NotificationContext context)
-    {
+    public void onBecomeSlaveFromOffline(Message message, NotificationContext context) {
       String partitionName = message.getPartitionName();
       String instanceName = message.getTgtName();
       System.out.println(instanceName + " becomes SLAVE from OFFLINE for " + partitionName);
     }
 
     @Transition(to = "MASTER", from = "SLAVE")
-    public void onBecomeMasterFromSlave(Message message, NotificationContext context)
-    {
+    public void onBecomeMasterFromSlave(Message message, NotificationContext context) {
       String partitionName = message.getPartitionName();
       String instanceName = message.getTgtName();
       System.out.println(instanceName + " becomes MASTER from SLAVE for " + partitionName);
     }
 
     @Transition(to = "SLAVE", from = "MASTER")
-    public void onBecomeSlaveFromMaster(Message message, NotificationContext context)
-    {
+    public void onBecomeSlaveFromMaster(Message message, NotificationContext context) {
       String partitionName = message.getPartitionName();
       String instanceName = message.getTgtName();
       System.out.println(instanceName + " becomes SLAVE from MASTER for " + partitionName);
     }
 
     @Transition(to = "OFFLINE", from = "SLAVE")
-    public void onBecomeOfflineFromSlave(Message message, NotificationContext context)
-    {
+    public void onBecomeOfflineFromSlave(Message message, NotificationContext context) {
       String partitionName = message.getPartitionName();
       String instanceName = message.getTgtName();
       System.out.println(instanceName + " becomes OFFLINE from SLAVE for " + partitionName);
     }
 
     @Transition(to = "DROPPED", from = "OFFLINE")
-    public void onBecomeDroppedFromOffline(Message message, NotificationContext context)
-    {
+    public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
       String partitionName = message.getPartitionName();
       String instanceName = message.getTgtName();
       System.out.println(instanceName + " becomes DROPPED from OFFLINE for " + partitionName);
     }
 
     @Transition(to = "OFFLINE", from = "ERROR")
-    public void onBecomeOfflineFromError(Message message, NotificationContext context)
-    {
+    public void onBecomeOfflineFromError(Message message, NotificationContext context) {
       String partitionName = message.getPartitionName();
       String instanceName = message.getTgtName();
       System.out.println(instanceName + " becomes OFFLINE from ERROR for " + partitionName);
     }
 
     @Override
-    public void reset()
-    {
+    public void reset() {
       System.out.println("Default MockMSStateModel.reset() invoked");
     }
   }
 
   // dummy master slave state model factory
-  public static class DummyMSModelFactory extends StateModelFactory<DummyMSStateModel>
-  {
+  public static class DummyMSModelFactory extends StateModelFactory<DummyMSStateModel> {
     @Override
-    public DummyMSStateModel createNewStateModel(String partitionName)
-    {
+    public DummyMSStateModel createNewStateModel(String partitionName) {
       DummyMSStateModel model = new DummyMSStateModel();
       return model;
     }
   }
 
-  public static void main(String[] args)
-  {
-    if (args.length < 3)
-    {
+  public static void main(String[] args) {
+    if (args.length < 3) {
       System.err.println("USAGE: DummyParticipant zkAddress clusterName instanceName");
       System.exit(1);
     }
@@ -115,10 +104,10 @@ public class DummyParticipant
     String instanceName = args[2];
 
     HelixManager manager = null;
-    try
-    {
-      manager = HelixManagerFactory.getZKHelixManager(clusterName, instanceName,
-          InstanceType.PARTICIPANT, zkAddr);
+    try {
+      manager =
+          HelixManagerFactory.getZKHelixManager(clusterName, instanceName,
+              InstanceType.PARTICIPANT, zkAddr);
 
       StateMachineEngine stateMach = manager.getStateMachineEngine();
       DummyMSModelFactory msModelFactory = new DummyMSModelFactory();
@@ -127,14 +116,11 @@ public class DummyParticipant
       manager.connect();
 
       Thread.currentThread().join();
-    } catch (Exception e)
-    {
+    } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
-    } finally
-    {
-      if (manager != null)
-      {
+    } finally {
+      if (manager != null) {
         manager.disconnect();
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java b/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java
index af77f02..44ee1e5 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java
@@ -26,32 +26,26 @@ import org.I0Itec.zkclient.IDefaultNameSpace;
 import org.I0Itec.zkclient.ZkServer;
 import org.apache.commons.io.FileUtils;
 
-public class ExampleHelper
-{
-  
-  
-  public static ZkServer startZkServer(String zkAddr)
-  {
+public class ExampleHelper {
+
+  public static ZkServer startZkServer(String zkAddr) {
     System.out.println("Start zookeeper at " + zkAddr + " in thread "
         + Thread.currentThread().getName());
 
     String zkDir = zkAddr.replace(':', '_');
     final String logDir = "/tmp/" + zkDir + "/logs";
     final String dataDir = "/tmp/" + zkDir + "/dataDir";
-    try
-    {
+    try {
       FileUtils.deleteDirectory(new File(dataDir));
       FileUtils.deleteDirectory(new File(logDir));
-    } catch (IOException e)
-    {
+    } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
 
     IDefaultNameSpace defaultNameSpace = new IDefaultNameSpace() {
       @Override
-      public void createDefaultNameSpace(org.I0Itec.zkclient.ZkClient zkClient)
-      {
+      public void createDefaultNameSpace(org.I0Itec.zkclient.ZkClient zkClient) {
         // do nothing
       }
     };
@@ -62,14 +56,12 @@ public class ExampleHelper
 
     return zkServer;
   }
-  
-  public static void stopZkServer(ZkServer zkServer)
-  {
-    if (zkServer != null)
-    {
+
+  public static void stopZkServer(ZkServer zkServer) {
+    if (zkServer != null) {
       zkServer.shutdown();
-      System.out.println("Shut down zookeeper at port " + zkServer.getPort()
-          + " in thread " + Thread.currentThread().getName());
+      System.out.println("Shut down zookeeper at port " + zkServer.getPort() + " in thread "
+          + Thread.currentThread().getName());
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/ExampleProcess.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/ExampleProcess.java b/helix-core/src/main/java/org/apache/helix/examples/ExampleProcess.java
index c94c25b..34a13e5 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/ExampleProcess.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/ExampleProcess.java
@@ -39,8 +39,7 @@ import org.apache.helix.participant.statemachine.StateModel;
 import org.apache.helix.participant.statemachine.StateModelFactory;
 import org.apache.helix.tools.ClusterStateVerifier;
 
-public class ExampleProcess
-{
+public class ExampleProcess {
 
   public static final String zkServer = "zkSvr";
   public static final String cluster = "cluster";
@@ -63,9 +62,8 @@ public class ExampleProcess
   private StateModelFactory<StateModel> stateModelFactory;
   private final int delay;
 
-  public ExampleProcess(String zkConnectString, String clusterName,
-      String instanceName, String file, String stateModel, int delay)
-  {
+  public ExampleProcess(String zkConnectString, String clusterName, String instanceName,
+      String file, String stateModel, int delay) {
     this.zkConnectString = zkConnectString;
     this.clusterName = clusterName;
     this.instanceName = instanceName;
@@ -73,19 +71,16 @@ public class ExampleProcess
     this.delay = delay;
   }
 
-  public void start() throws Exception
-  {
-    manager = HelixManagerFactory.getZKHelixManager(clusterName, instanceName,
-        InstanceType.PARTICIPANT, zkConnectString);
-    
-    if ("MasterSlave".equalsIgnoreCase(stateModelType))
-    {
+  public void start() throws Exception {
+    manager =
+        HelixManagerFactory.getZKHelixManager(clusterName, instanceName, InstanceType.PARTICIPANT,
+            zkConnectString);
+
+    if ("MasterSlave".equalsIgnoreCase(stateModelType)) {
       stateModelFactory = new MasterSlaveStateModelFactory(delay);
-    } else if ("OnlineOffline".equalsIgnoreCase(stateModelType))
-    {
+    } else if ("OnlineOffline".equalsIgnoreCase(stateModelType)) {
       stateModelFactory = new OnlineOfflineStateModelFactory(delay);
-    } else if ("LeaderStandby".equalsIgnoreCase(stateModelType))
-    {
+    } else if ("LeaderStandby".equalsIgnoreCase(stateModelType)) {
       stateModelFactory = new LeaderStandbyStateModelFactory(delay);
     }
     // genericStateMachineHandler = new StateMachineEngine();
@@ -99,56 +94,56 @@ public class ExampleProcess
         MessageType.STATE_TRANSITION.toString(), stateMach);
   }
 
-  public void stop()
-  {
+  public void stop() {
     manager.disconnect();
   }
 
   @SuppressWarnings("static-access")
-  private static Options constructCommandLineOptions()
-  {
-    Option helpOption = OptionBuilder.withLongOpt(help)
-        .withDescription("Prints command-line options info").create();
+  private static Options constructCommandLineOptions() {
+    Option helpOption =
+        OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info")
+            .create();
 
-    Option zkServerOption = OptionBuilder.withLongOpt(zkServer)
-        .withDescription("Provide zookeeper address").create();
+    Option zkServerOption =
+        OptionBuilder.withLongOpt(zkServer).withDescription("Provide zookeeper address").create();
     zkServerOption.setArgs(1);
     zkServerOption.setRequired(true);
     zkServerOption.setArgName("ZookeeperServerAddress(Required)");
 
-    Option clusterOption = OptionBuilder.withLongOpt(cluster)
-        .withDescription("Provide cluster name").create();
+    Option clusterOption =
+        OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create();
     clusterOption.setArgs(1);
     clusterOption.setRequired(true);
     clusterOption.setArgName("Cluster name (Required)");
 
-    Option hostOption = OptionBuilder.withLongOpt(hostAddress)
-        .withDescription("Provide host name").create();
+    Option hostOption =
+        OptionBuilder.withLongOpt(hostAddress).withDescription("Provide host name").create();
     hostOption.setArgs(1);
     hostOption.setRequired(true);
     hostOption.setArgName("Host name (Required)");
 
-    Option portOption = OptionBuilder.withLongOpt(hostPort)
-        .withDescription("Provide host port").create();
+    Option portOption =
+        OptionBuilder.withLongOpt(hostPort).withDescription("Provide host port").create();
     portOption.setArgs(1);
     portOption.setRequired(true);
     portOption.setArgName("Host port (Required)");
 
-    Option stateModelOption = OptionBuilder.withLongOpt(stateModel)
-        .withDescription("StateModel Type").create();
+    Option stateModelOption =
+        OptionBuilder.withLongOpt(stateModel).withDescription("StateModel Type").create();
     stateModelOption.setArgs(1);
     stateModelOption.setRequired(true);
     stateModelOption.setArgName("StateModel Type (Required)");
 
     // add an option group including either --zkSvr or --configFile
-    Option fileOption = OptionBuilder.withLongOpt(configFile)
-        .withDescription("Provide file to read states/messages").create();
+    Option fileOption =
+        OptionBuilder.withLongOpt(configFile)
+            .withDescription("Provide file to read states/messages").create();
     fileOption.setArgs(1);
     fileOption.setRequired(true);
     fileOption.setArgName("File to read states/messages (Optional)");
 
-    Option transDelayOption = OptionBuilder.withLongOpt(transDelay)
-        .withDescription("Provide state trans delay").create();
+    Option transDelayOption =
+        OptionBuilder.withLongOpt(transDelay).withDescription("Provide state trans delay").create();
     transDelayOption.setArgs(1);
     transDelayOption.setRequired(false);
     transDelayOption.setArgName("Delay time in state transition, in MS");
@@ -171,34 +166,26 @@ public class ExampleProcess
     return options;
   }
 
-  public static void printUsage(Options cliOptions)
-  {
+  public static void printUsage(Options cliOptions) {
     HelpFormatter helpFormatter = new HelpFormatter();
-    helpFormatter.printHelp("java " + ExampleProcess.class.getName(),
-        cliOptions);
+    helpFormatter.printHelp("java " + ExampleProcess.class.getName(), cliOptions);
   }
 
-  public static CommandLine processCommandLineArgs(String[] cliArgs)
-      throws Exception
-  {
+  public static CommandLine processCommandLineArgs(String[] cliArgs) throws Exception {
     CommandLineParser cliParser = new GnuParser();
     Options cliOptions = constructCommandLineOptions();
-    try
-    {
+    try {
       return cliParser.parse(cliOptions, cliArgs);
-    } catch (ParseException pe)
-    {
-      System.err
-          .println("CommandLineClient: failed to parse command-line options: "
-              + pe.toString());
+    } catch (ParseException pe) {
+      System.err.println("CommandLineClient: failed to parse command-line options: "
+          + pe.toString());
       printUsage(cliOptions);
       System.exit(1);
     }
     return null;
   }
 
-  public static void main(String[] args) throws Exception
-  {
+  public static void main(String[] args) throws Exception {
     String zkConnectString = "localhost:2181";
     String clusterName = "storage-integration-cluster";
     String instanceName = "localhost_8905";
@@ -206,8 +193,7 @@ public class ExampleProcess
     String stateModelValue = "MasterSlave";
     int delay = 0;
     boolean skipZeroArgs = true;// false is for dev testing
-    if (!skipZeroArgs || args.length > 0)
-    {
+    if (!skipZeroArgs || args.length > 0) {
       CommandLine cmd = processCommandLineArgs(args);
       zkConnectString = cmd.getOptionValue(zkServer);
       clusterName = cmd.getOptionValue(cluster);
@@ -218,28 +204,22 @@ public class ExampleProcess
       instanceName = host + "_" + port;
 
       file = cmd.getOptionValue(configFile);
-      if (file != null)
-      {
+      if (file != null) {
         File f = new File(file);
-        if (!f.exists())
-        {
+        if (!f.exists()) {
           System.err.println("static config file doesn't exist");
           System.exit(1);
         }
       }
 
       stateModelValue = cmd.getOptionValue(stateModel);
-      if (cmd.hasOption(transDelay))
-      {
-        try
-        {
+      if (cmd.hasOption(transDelay)) {
+        try {
           delay = Integer.parseInt(cmd.getOptionValue(transDelay));
-          if (delay < 0)
-          {
+          if (delay < 0) {
             throw new Exception("delay must be positive");
           }
-        } catch (Exception e)
-        {
+        } catch (Exception e) {
           e.printStackTrace();
           delay = 0;
         }
@@ -248,8 +228,8 @@ public class ExampleProcess
     // Espresso_driver.py will consume this
     System.out.println("Starting Process with ZK:" + zkConnectString);
 
-    ExampleProcess process = new ExampleProcess(zkConnectString, clusterName,
-        instanceName, file, stateModelValue, delay);
+    ExampleProcess process =
+        new ExampleProcess(zkConnectString, clusterName, instanceName, file, stateModelValue, delay);
 
     process.start();
     Thread.currentThread().join();

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/IdealStateBuilderExample.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/IdealStateBuilderExample.java b/helix-core/src/main/java/org/apache/helix/examples/IdealStateBuilderExample.java
index 2d18630..4f76352 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/IdealStateBuilderExample.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/IdealStateBuilderExample.java
@@ -37,12 +37,13 @@ public class IdealStateBuilderExample {
   private static String buildPartitionName(String resourceName, int partitionNum) {
     return resourceName + "_" + partitionNum;
   }
-  
+
   public static void main(String[] args) {
-    
+
     if (args.length < 3) {
-      System.err.println("USAGE: java IdealStateBuilderExample zkAddress clusterName idealStateMode" +
-          " (FULL_AUTO, SEMI_AUTO, CUSTOMIZED, or USER_DEFINED)");
+      System.err
+          .println("USAGE: java IdealStateBuilderExample zkAddress clusterName idealStateMode"
+              + " (FULL_AUTO, SEMI_AUTO, CUSTOMIZED, or USER_DEFINED)");
       System.exit(1);
     }
 
@@ -51,19 +52,16 @@ public class IdealStateBuilderExample {
     RebalanceMode idealStateMode = RebalanceMode.valueOf(args[2].toUpperCase());
 
     ZkClient zkclient =
-        new ZkClient(zkAddr,
-                     ZkClient.DEFAULT_SESSION_TIMEOUT,
-                     ZkClient.DEFAULT_CONNECTION_TIMEOUT,
-                     new ZNRecordSerializer());
+        new ZkClient(zkAddr, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT,
+            new ZNRecordSerializer());
     ZKHelixAdmin admin = new ZKHelixAdmin(zkclient);
-    
+
     // add cluster
     admin.addCluster(clusterName, true);
 
     // add MasterSlave state model definition
-    admin.addStateModelDef(clusterName,
-                           "MasterSlave",
-                           new StateModelDefinition(StateModelConfigGenerator.generateConfigForMasterSlave()));
+    admin.addStateModelDef(clusterName, "MasterSlave", new StateModelDefinition(
+        StateModelConfigGenerator.generateConfigForMasterSlave()));
 
     // add 2 participants: "localhost:{12918, 12919}"
     int n = 2;
@@ -75,50 +73,45 @@ public class IdealStateBuilderExample {
       config.setInstanceEnabled(true);
       admin.addInstance(clusterName, config);
     }
-    
+
     // add ideal-state according to ideal-state-mode
     String resourceName = "TestDB";
     IdealState idealState = null;
     switch (idealStateMode) {
     case SEMI_AUTO: {
       AutoModeISBuilder builder = new AutoModeISBuilder(resourceName);
-      builder.setStateModel("MasterSlave")
-             .setNumPartitions(2)
-             .setNumReplica(2);
-      builder.assignPreferenceList(buildPartitionName(resourceName, 0), "localhost_12918", "localhost_12919")
-             .assignPreferenceList(buildPartitionName(resourceName, 1), "localhost_12919", "localhost_12918");
-      
+      builder.setStateModel("MasterSlave").setNumPartitions(2).setNumReplica(2);
+      builder.assignPreferenceList(buildPartitionName(resourceName, 0), "localhost_12918",
+          "localhost_12919").assignPreferenceList(buildPartitionName(resourceName, 1),
+          "localhost_12919", "localhost_12918");
+
       idealState = builder.build();
       break;
     }
     case FULL_AUTO: {
       AutoRebalanceModeISBuilder builder = new AutoRebalanceModeISBuilder(resourceName);
-      builder.setStateModel("MasterSlave")
-              .setNumPartitions(2)
-              .setNumReplica(2)
-              .setMaxPartitionsPerNode(2);
-      builder.add(buildPartitionName(resourceName, 0))
-             .add(buildPartitionName(resourceName, 1));
-      
+      builder.setStateModel("MasterSlave").setNumPartitions(2).setNumReplica(2)
+          .setMaxPartitionsPerNode(2);
+      builder.add(buildPartitionName(resourceName, 0)).add(buildPartitionName(resourceName, 1));
+
       idealState = builder.build();
       break;
     }
     case CUSTOMIZED: {
       CustomModeISBuilder builder = new CustomModeISBuilder(resourceName);
-      builder.setStateModel("MasterSlave")
-              .setNumPartitions(2)
-              .setNumReplica(2);
-      builder.assignInstanceAndState(buildPartitionName(resourceName, 0), "localhost_12918", "MASTER")
-              .assignInstanceAndState(buildPartitionName(resourceName, 0), "localhost_12919", "SLAVE")
-              .assignInstanceAndState(buildPartitionName(resourceName, 1), "localhost_12918", "SLAVE")
-              .assignInstanceAndState(buildPartitionName(resourceName, 1), "localhost_12919", "MASTER");
+      builder.setStateModel("MasterSlave").setNumPartitions(2).setNumReplica(2);
+      builder
+          .assignInstanceAndState(buildPartitionName(resourceName, 0), "localhost_12918", "MASTER")
+          .assignInstanceAndState(buildPartitionName(resourceName, 0), "localhost_12919", "SLAVE")
+          .assignInstanceAndState(buildPartitionName(resourceName, 1), "localhost_12918", "SLAVE")
+          .assignInstanceAndState(buildPartitionName(resourceName, 1), "localhost_12919", "MASTER");
       idealState = builder.build();
       break;
     }
     default:
       break;
     }
-    
+
     admin.addResource(clusterName, resourceName, idealState);
 
     // start helix controller
@@ -126,8 +119,9 @@ public class IdealStateBuilderExample {
       @Override
       public void run() {
         try {
-          HelixControllerMain.main(new String[] { "--zkSvr", zkAddr, "--cluster",
-              clusterName});
+          HelixControllerMain.main(new String[] {
+              "--zkSvr", zkAddr, "--cluster", clusterName
+          });
         } catch (Exception e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
@@ -142,7 +136,9 @@ public class IdealStateBuilderExample {
       new Thread(new Runnable() {
         @Override
         public void run() {
-          DummyParticipant.main(new String[] { zkAddr, clusterName, instanceName });
+          DummyParticipant.main(new String[] {
+              zkAddr, clusterName, instanceName
+          });
         }
       }).start();
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/IdealStateExample.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/IdealStateExample.java b/helix-core/src/main/java/org/apache/helix/examples/IdealStateExample.java
index 23249a4..7c5192d 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/IdealStateExample.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/IdealStateExample.java
@@ -28,10 +28,10 @@ import org.apache.helix.model.InstanceConfig;
 import org.apache.helix.model.StateModelDefinition;
 import org.apache.helix.tools.StateModelConfigGenerator;
 
-
 /**
  * Ideal state json format file used in this example for CUSTOMIZED ideal state mode
  * <p>
+ * 
  * <pre>
  * {
  * "id" : "TestDB",
@@ -68,17 +68,14 @@ import org.apache.helix.tools.StateModelConfigGenerator;
  * }
  * }
  * </pre>
- * 
  */
 
-public class IdealStateExample
-{
+public class IdealStateExample {
 
-  public static void main(String[] args) throws Exception
-  {
-    if (args.length < 3)
-    {
-      System.err.println("USAGE: IdealStateExample zkAddress clusterName idealStateMode (FULL_AUTO, SEMI_AUTO, or CUSTOMIZED) idealStateJsonFile (required for CUSTOMIZED mode)");
+  public static void main(String[] args) throws Exception {
+    if (args.length < 3) {
+      System.err
+          .println("USAGE: IdealStateExample zkAddress clusterName idealStateMode (FULL_AUTO, SEMI_AUTO, or CUSTOMIZED) idealStateJsonFile (required for CUSTOMIZED mode)");
       System.exit(1);
     }
 
@@ -86,12 +83,9 @@ public class IdealStateExample
     final String clusterName = args[1];
     final String idealStateRebalancerModeStr = args[2].toUpperCase();
     String idealStateJsonFile = null;
-    RebalanceMode idealStateRebalancerMode =
-        RebalanceMode.valueOf(idealStateRebalancerModeStr);
-    if (idealStateRebalancerMode == RebalanceMode.CUSTOMIZED)
-    {
-      if (args.length < 4)
-      {
+    RebalanceMode idealStateRebalancerMode = RebalanceMode.valueOf(idealStateRebalancerModeStr);
+    if (idealStateRebalancerMode == RebalanceMode.CUSTOMIZED) {
+      if (args.length < 4) {
         System.err.println("Missng idealStateJsonFile for CUSTOMIZED ideal state mode");
         System.exit(1);
       }
@@ -100,22 +94,18 @@ public class IdealStateExample
 
     // add cluster {clusterName}
     ZkClient zkclient =
-        new ZkClient(zkAddr,
-                     ZkClient.DEFAULT_SESSION_TIMEOUT,
-                     ZkClient.DEFAULT_CONNECTION_TIMEOUT,
-                     new ZNRecordSerializer());
+        new ZkClient(zkAddr, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT,
+            new ZNRecordSerializer());
     ZKHelixAdmin admin = new ZKHelixAdmin(zkclient);
     admin.addCluster(clusterName, true);
 
     // add MasterSlave state mode definition
     StateModelConfigGenerator generator = new StateModelConfigGenerator();
-    admin.addStateModelDef(clusterName,
-                           "MasterSlave",
-                           new StateModelDefinition(generator.generateConfigForMasterSlave()));
+    admin.addStateModelDef(clusterName, "MasterSlave",
+        new StateModelDefinition(generator.generateConfigForMasterSlave()));
 
     // add 3 participants: "localhost:{12918, 12919, 12920}"
-    for (int i = 0; i < 3; i++)
-    {
+    for (int i = 0; i < 3; i++) {
       int port = 12918 + i;
       InstanceConfig config = new InstanceConfig("localhost_" + port);
       config.setHostName("localhost");
@@ -127,32 +117,25 @@ public class IdealStateExample
     // add resource "TestDB" which has 4 partitions and uses MasterSlave state model
     String resourceName = "TestDB";
     if (idealStateRebalancerMode == RebalanceMode.SEMI_AUTO
-        || idealStateRebalancerMode == RebalanceMode.FULL_AUTO)
-    {
+        || idealStateRebalancerMode == RebalanceMode.FULL_AUTO) {
       admin.addResource(clusterName, resourceName, 4, "MasterSlave", idealStateRebalancerModeStr);
 
       // rebalance resource "TestDB" using 3 replicas
       admin.rebalance(clusterName, resourceName, 3);
-    }
-    else if (idealStateRebalancerMode == RebalanceMode.CUSTOMIZED)
-    {
+    } else if (idealStateRebalancerMode == RebalanceMode.CUSTOMIZED) {
       admin.addIdealState(clusterName, resourceName, idealStateJsonFile);
     }
 
     // start helix controller
-    new Thread(new Runnable()
-    {
+    new Thread(new Runnable() {
 
       @Override
-      public void run()
-      {
-        try
-        {
-          HelixControllerMain.main(new String[] { "--zkSvr", zkAddr, "--cluster",
-              clusterName });
-        }
-        catch (Exception e)
-        {
+      public void run() {
+        try {
+          HelixControllerMain.main(new String[] {
+              "--zkSvr", zkAddr, "--cluster", clusterName
+          });
+        } catch (Exception e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
         }
@@ -161,17 +144,16 @@ public class IdealStateExample
     }).start();
 
     // start 3 dummy participants
-    for (int i = 0; i < 3; i++)
-    {
+    for (int i = 0; i < 3; i++) {
       int port = 12918 + i;
       final String instanceName = "localhost_" + port;
-      new Thread(new Runnable()
-      {
+      new Thread(new Runnable() {
 
         @Override
-        public void run()
-        {
-          DummyParticipant.main(new String[] { zkAddr, clusterName, instanceName });
+        public void run() {
+          DummyParticipant.main(new String[] {
+              zkAddr, clusterName, instanceName
+          });
         }
       }).start();
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java b/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java
index f36acf9..43ac5de 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java
@@ -24,48 +24,43 @@ import org.apache.helix.model.Message;
 import org.apache.helix.participant.statemachine.StateModel;
 import org.apache.helix.participant.statemachine.StateModelFactory;
 
-public class LeaderStandbyStateModelFactory extends
-		StateModelFactory<StateModel> {
-	int _delay;
+public class LeaderStandbyStateModelFactory extends StateModelFactory<StateModel> {
+  int _delay;
 
-	public LeaderStandbyStateModelFactory(int delay) {
-		_delay = delay;
-	}
+  public LeaderStandbyStateModelFactory(int delay) {
+    _delay = delay;
+  }
 
-	@Override
-	public StateModel createNewStateModel(String stateUnitKey) {
-		LeaderStandbyStateModel stateModel = new LeaderStandbyStateModel();
-		stateModel.setDelay(_delay);
-		return stateModel;
-	}
+  @Override
+  public StateModel createNewStateModel(String stateUnitKey) {
+    LeaderStandbyStateModel stateModel = new LeaderStandbyStateModel();
+    stateModel.setDelay(_delay);
+    return stateModel;
+  }
 
-	public static class LeaderStandbyStateModel extends StateModel {
-		int _transDelay = 0;
+  public static class LeaderStandbyStateModel extends StateModel {
+    int _transDelay = 0;
 
-		public void setDelay(int delay) {
-			_transDelay = delay > 0 ? delay : 0;
-		}
+    public void setDelay(int delay) {
+      _transDelay = delay > 0 ? delay : 0;
+    }
 
-		public void onBecomeLeaderFromStandby(Message message,
-				NotificationContext context) {
-			System.out
-					.println("LeaderStandbyStateModel.onBecomeLeaderFromStandby()");
-			sleep();
-		}
+    public void onBecomeLeaderFromStandby(Message message, NotificationContext context) {
+      System.out.println("LeaderStandbyStateModel.onBecomeLeaderFromStandby()");
+      sleep();
+    }
 
-		public void onBecomeStandbyFromLeader(Message message,
-				NotificationContext context) {
-			System.out
-					.println("LeaderStandbyStateModel.onBecomeStandbyFromLeader()");
-			sleep();
-		}
+    public void onBecomeStandbyFromLeader(Message message, NotificationContext context) {
+      System.out.println("LeaderStandbyStateModel.onBecomeStandbyFromLeader()");
+      sleep();
+    }
 
-		private void sleep() {
-			try {
-				Thread.sleep(_transDelay);
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-	}
-}
\ No newline at end of file
+    private void sleep() {
+      try {
+        Thread.sleep(_transDelay);
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java b/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java
index 732e59e..affbea8 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java
@@ -25,31 +25,26 @@ import org.apache.helix.participant.statemachine.StateModel;
 import org.apache.helix.participant.statemachine.StateModelFactory;
 
 @SuppressWarnings("rawtypes")
-public class MasterSlaveStateModelFactory extends StateModelFactory<StateModel>
-{
+public class MasterSlaveStateModelFactory extends StateModelFactory<StateModel> {
   int _delay;
 
   String _instanceName = "";
 
-  public MasterSlaveStateModelFactory(int delay)
-  {
+  public MasterSlaveStateModelFactory(int delay) {
     _delay = delay;
   }
 
-  public MasterSlaveStateModelFactory(String instanceName)
-  {
+  public MasterSlaveStateModelFactory(String instanceName) {
     _instanceName = instanceName;
     _delay = 10;
   }
 
-  public MasterSlaveStateModelFactory()
-  {
+  public MasterSlaveStateModelFactory() {
     this(10);
   }
 
   @Override
-  public StateModel createNewStateModel(String partitionName)
-  {
+  public StateModel createNewStateModel(String partitionName) {
     MasterSlaveStateModel stateModel = new MasterSlaveStateModel();
     stateModel.setInstanceName(_instanceName);
     stateModel.setDelay(_delay);
@@ -57,88 +52,65 @@ public class MasterSlaveStateModelFactory extends StateModelFactory<StateModel>
     return stateModel;
   }
 
-  public static class MasterSlaveStateModel extends StateModel
-  {
+  public static class MasterSlaveStateModel extends StateModel {
     int _transDelay = 0;
     String partitionName;
     String _instanceName = "";
 
-    public String getPartitionName()
-    {
+    public String getPartitionName() {
       return partitionName;
     }
 
-    public void setPartitionName(String partitionName)
-    {
+    public void setPartitionName(String partitionName) {
       this.partitionName = partitionName;
     }
 
-    public void setDelay(int delay)
-    {
+    public void setDelay(int delay) {
       _transDelay = delay > 0 ? delay : 0;
     }
 
-    public void setInstanceName(String instanceName)
-    {
+    public void setInstanceName(String instanceName) {
       _instanceName = instanceName;
     }
 
-    public void onBecomeSlaveFromOffline(Message message,
-        NotificationContext context)
-    {
+    public void onBecomeSlaveFromOffline(Message message, NotificationContext context) {
 
-      System.out.println(_instanceName + " transitioning from "
-          + message.getFromState() + " to " + message.getToState() + " for "
-          + partitionName);
+      System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to "
+          + message.getToState() + " for " + partitionName);
       sleep();
     }
 
-    private void sleep()
-    {
-      try
-      {
+    private void sleep() {
+      try {
         Thread.sleep(_transDelay);
-      } catch (Exception e)
-      {
+      } catch (Exception e) {
         e.printStackTrace();
       }
     }
 
-    public void onBecomeSlaveFromMaster(Message message,
-        NotificationContext context)
-    {
-      System.out.println(_instanceName + " transitioning from "
-          + message.getFromState() + " to " + message.getToState() + " for "
-          + partitionName);
+    public void onBecomeSlaveFromMaster(Message message, NotificationContext context) {
+      System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to "
+          + message.getToState() + " for " + partitionName);
       sleep();
 
     }
 
-    public void onBecomeMasterFromSlave(Message message,
-        NotificationContext context)
-    {
-      System.out.println(_instanceName + " transitioning from "
-          + message.getFromState() + " to " + message.getToState() + " for "
-          + partitionName);
+    public void onBecomeMasterFromSlave(Message message, NotificationContext context) {
+      System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to "
+          + message.getToState() + " for " + partitionName);
       sleep();
 
     }
 
-    public void onBecomeOfflineFromSlave(Message message,
-        NotificationContext context)
-    {
-      System.out.println(_instanceName + " transitioning from "
-          + message.getFromState() + " to " + message.getToState() + " for "
-          + partitionName);
+    public void onBecomeOfflineFromSlave(Message message, NotificationContext context) {
+      System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to "
+          + message.getToState() + " for " + partitionName);
       sleep();
 
     }
 
-    public void onBecomeDroppedFromOffline(Message message,
-        NotificationContext context)
-    {
-      System.out.println(_instanceName + " Dropping partition "
-          + partitionName);
+    public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
+      System.out.println(_instanceName + " Dropping partition " + partitionName);
       sleep();
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java b/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java
index 6eb3d2f..daf03a9 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java
@@ -24,55 +24,49 @@ import org.apache.helix.model.Message;
 import org.apache.helix.participant.statemachine.StateModel;
 import org.apache.helix.participant.statemachine.StateModelFactory;
 
-public class OnlineOfflineStateModelFactory extends
-		StateModelFactory<StateModel> {
-	int _delay;
+public class OnlineOfflineStateModelFactory extends StateModelFactory<StateModel> {
+  int _delay;
 
-	public OnlineOfflineStateModelFactory(int delay) {
-		_delay = delay;
-	}
+  public OnlineOfflineStateModelFactory(int delay) {
+    _delay = delay;
+  }
 
-	@Override
-	public StateModel createNewStateModel(String stateUnitKey) {
-		OnlineOfflineStateModel stateModel = new OnlineOfflineStateModel();
-		stateModel.setDelay(_delay);
-		return stateModel;
-	}
+  @Override
+  public StateModel createNewStateModel(String stateUnitKey) {
+    OnlineOfflineStateModel stateModel = new OnlineOfflineStateModel();
+    stateModel.setDelay(_delay);
+    return stateModel;
+  }
 
-	public static class OnlineOfflineStateModel extends StateModel {
-		int _transDelay = 0;
+  public static class OnlineOfflineStateModel extends StateModel {
+    int _transDelay = 0;
 
-		public void setDelay(int delay) {
-			_transDelay = delay > 0 ? delay : 0;
-		}
+    public void setDelay(int delay) {
+      _transDelay = delay > 0 ? delay : 0;
+    }
 
-		public void onBecomeOnlineFromOffline(Message message,
-				NotificationContext context) {
-			System.out
-					.println("OnlineOfflineStateModel.onBecomeOnlineFromOffline()");
-			sleep();
-		}
+    public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
+      System.out.println("OnlineOfflineStateModel.onBecomeOnlineFromOffline()");
+      sleep();
+    }
 
-		public void onBecomeOfflineFromOnline(Message message,
-				NotificationContext context) {
-			System.out
-					.println("OnlineOfflineStateModel.onBecomeOfflineFromOnline()");
-			sleep();
-		}
-		
-		public void onBecomeDroppedFromOffline(Message message,
-        NotificationContext context) {
+    public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
+      System.out.println("OnlineOfflineStateModel.onBecomeOfflineFromOnline()");
+      sleep();
+    }
+
+    public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
       System.out.println("OnlineOfflineStateModel.onBecomeDroppedFromOffline()");
       sleep();
 
     }
 
-		private void sleep() {
-			try {
-				Thread.sleep(_transDelay);
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-	}
+    private void sleep() {
+      try {
+        Thread.sleep(_transDelay);
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/examples/Quickstart.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/examples/Quickstart.java b/helix-core/src/main/java/org/apache/helix/examples/Quickstart.java
index 38fde08..b80d458 100644
--- a/helix-core/src/main/java/org/apache/helix/examples/Quickstart.java
+++ b/helix-core/src/main/java/org/apache/helix/examples/Quickstart.java
@@ -40,8 +40,7 @@ import org.apache.helix.model.InstanceConfig;
 import org.apache.helix.model.StateModelDefinition;
 import org.apache.helix.participant.StateMachineEngine;
 
-public class Quickstart
-{
+public class Quickstart {
 
   private static String ZK_ADDRESS = "localhost:2199";
   private static String CLUSTER_NAME = "HELIX_QUICKSTART";
@@ -61,12 +60,10 @@ public class Quickstart
   private static List<InstanceConfig> INSTANCE_CONFIG_LIST;
   private static List<MyProcess> PROCESS_LIST;
   private static HelixAdmin admin;
-  static
-  {
+  static {
     INSTANCE_CONFIG_LIST = new ArrayList<InstanceConfig>();
     PROCESS_LIST = new ArrayList<Quickstart.MyProcess>();
-    for (int i = 0; i < NUM_NODES; i++)
-    {
+    for (int i = 0; i < NUM_NODES; i++) {
       int port = 12000 + i;
       InstanceConfig instanceConfig = new InstanceConfig("localhost_" + port);
       instanceConfig.setHostName("localhost");
@@ -77,8 +74,7 @@ public class Quickstart
 
   }
 
-  public static void setup()
-  {
+  public static void setup() {
     admin = new ZKHelixAdmin(ZK_ADDRESS);
     // create cluster
     echo("Creating cluster: " + CLUSTER_NAME);
@@ -86,11 +82,9 @@ public class Quickstart
 
     // Add nodes to the cluster
     echo("Adding " + NUM_NODES + " participants to the cluster");
-    for (int i = 0; i < NUM_NODES; i++)
-    {
+    for (int i = 0; i < NUM_NODES; i++) {
       admin.addInstance(CLUSTER_NAME, INSTANCE_CONFIG_LIST.get(i));
-      echo("\t Added participant: "
-          + INSTANCE_CONFIG_LIST.get(i).getInstanceName());
+      echo("\t Added participant: " + INSTANCE_CONFIG_LIST.get(i).getInstanceName());
     }
 
     // Add a state model
@@ -100,17 +94,14 @@ public class Quickstart
 
     // Add a resource with 6 partitions and 2 replicas
     echo("Adding a resource MyResource: " + "with 6 partitions and 2 replicas");
-    admin.addResource(CLUSTER_NAME, RESOURCE_NAME, NUM_PARTITIONS,
-        STATE_MODEL_NAME, "AUTO");
+    admin.addResource(CLUSTER_NAME, RESOURCE_NAME, NUM_PARTITIONS, STATE_MODEL_NAME, "AUTO");
     // this will set up the ideal state, it calculates the preference list for
     // each partition similar to consistent hashing
     admin.rebalance(CLUSTER_NAME, RESOURCE_NAME, NUM_REPLICAS);
   }
 
-  private static StateModelDefinition defineStateModel()
-  {
-    StateModelDefinition.Builder builder = new StateModelDefinition.Builder(
-        STATE_MODEL_NAME);
+  private static StateModelDefinition defineStateModel() {
+    StateModelDefinition.Builder builder = new StateModelDefinition.Builder(STATE_MODEL_NAME);
     // Add states and their rank to indicate priority. Lower the rank higher the
     // priority
     builder.addState(MASTER, 1);
@@ -138,19 +129,16 @@ public class Quickstart
     return statemodelDefinition;
   }
 
-  public static void startController()
-  {
+  public static void startController() {
     // start controller
     echo("Starting Helix Controller");
-    HelixControllerMain.startHelixController(ZK_ADDRESS, CLUSTER_NAME,
-        "localhost_9100", HelixControllerMain.STANDALONE);
+    HelixControllerMain.startHelixController(ZK_ADDRESS, CLUSTER_NAME, "localhost_9100",
+        HelixControllerMain.STANDALONE);
   }
 
-  public static void startNodes() throws Exception
-  {
+  public static void startNodes() throws Exception {
     echo("Starting Participants");
-    for (int i = 0; i < NUM_NODES; i++)
-    {
+    for (int i = 0; i < NUM_NODES; i++) {
       MyProcess process = new MyProcess(INSTANCE_CONFIG_LIST.get(i).getId());
       PROCESS_LIST.add(process);
       process.start();
@@ -158,30 +146,26 @@ public class Quickstart
     }
   }
 
-  public static void startZookeeper()
-  {
+  public static void startZookeeper() {
     echo("STARTING Zookeeper at " + ZK_ADDRESS);
-    IDefaultNameSpace defaultNameSpace = new IDefaultNameSpace()
-    {
+    IDefaultNameSpace defaultNameSpace = new IDefaultNameSpace() {
       @Override
-      public void createDefaultNameSpace(ZkClient zkClient)
-      {
+      public void createDefaultNameSpace(ZkClient zkClient) {
       }
     };
     new File("/tmp/helix-quickstart").mkdirs();
     // start zookeeper
-    ZkServer server = new ZkServer("/tmp/helix-quickstart/dataDir",
-        "/tmp/helix-quickstart/logDir", defaultNameSpace, 2199);
+    ZkServer server =
+        new ZkServer("/tmp/helix-quickstart/dataDir", "/tmp/helix-quickstart/logDir",
+            defaultNameSpace, 2199);
     server.start();
   }
 
-  public static void echo(Object obj)
-  {
+  public static void echo(Object obj) {
     System.out.println(obj);
   }
 
-  public static void main(String[] args) throws Exception
-  {
+  public static void main(String[] args) throws Exception {
     startZookeeper();
     setup();
     startNodes();
@@ -198,8 +182,7 @@ public class Quickstart
     System.exit(0);
   }
 
-  private static void addNode() throws Exception
-  {
+  private static void addNode() throws Exception {
 
     NUM_NODES = NUM_NODES + 1;
     int port = 12000 + NUM_NODES - 1;
@@ -207,7 +190,8 @@ public class Quickstart
     instanceConfig.setHostName("localhost");
     instanceConfig.setPort("" + port);
     instanceConfig.setInstanceEnabled(true);
-    echo("ADDING NEW NODE :" + instanceConfig.getInstanceName()+ ". Partitions will move from old nodes to the new node.");
+    echo("ADDING NEW NODE :" + instanceConfig.getInstanceName()
+        + ". Partitions will move from old nodes to the new node.");
     admin.addInstance(CLUSTER_NAME, instanceConfig);
     INSTANCE_CONFIG_LIST.add(instanceConfig);
     MyProcess process = new MyProcess(instanceConfig.getInstanceName());
@@ -216,43 +200,31 @@ public class Quickstart
     process.start();
   }
 
-  private static void stopNode()
-  {
+  private static void stopNode() {
     int nodeId = NUM_NODES - 1;
-    echo("STOPPING " + INSTANCE_CONFIG_LIST.get(nodeId).getInstanceName()+". Mastership will be transferred to the remaining nodes");
+    echo("STOPPING " + INSTANCE_CONFIG_LIST.get(nodeId).getInstanceName()
+        + ". Mastership will be transferred to the remaining nodes");
     PROCESS_LIST.get(nodeId).stop();
   }
 
-  private static void printState(String msg)
-  {
-    System.out.println("CLUSTER STATE: "+ msg);
-    ExternalView resourceExternalView = admin.getResourceExternalView(
-        CLUSTER_NAME, RESOURCE_NAME);
-    TreeSet<String> sortedSet = new TreeSet<String>(
-        resourceExternalView.getPartitionSet());
+  private static void printState(String msg) {
+    System.out.println("CLUSTER STATE: " + msg);
+    ExternalView resourceExternalView = admin.getResourceExternalView(CLUSTER_NAME, RESOURCE_NAME);
+    TreeSet<String> sortedSet = new TreeSet<String>(resourceExternalView.getPartitionSet());
     StringBuilder sb = new StringBuilder("\t\t");
-    for (int i = 0; i < NUM_NODES; i++)
-    {
+    for (int i = 0; i < NUM_NODES; i++) {
       sb.append(INSTANCE_CONFIG_LIST.get(i).getInstanceName()).append("\t");
     }
     System.out.println(sb);
-    for (String partitionName : sortedSet)
-    {
+    for (String partitionName : sortedSet) {
       sb.delete(0, sb.length() - 1);
       sb.append(partitionName).append("\t");
-      for (int i = 0; i < NUM_NODES; i++)
-      {
-        Map<String, String> stateMap = resourceExternalView
-            .getStateMap(partitionName);
-        if (stateMap != null
-            && stateMap.containsKey(INSTANCE_CONFIG_LIST.get(i)
-                .getInstanceName()))
-        {
-          sb.append(
-              stateMap.get(INSTANCE_CONFIG_LIST.get(i).getInstanceName())
-                  .charAt(0)).append("\t\t");
-        } else
-        {
+      for (int i = 0; i < NUM_NODES; i++) {
+        Map<String, String> stateMap = resourceExternalView.getStateMap(partitionName);
+        if (stateMap != null && stateMap.containsKey(INSTANCE_CONFIG_LIST.get(i).getInstanceName())) {
+          sb.append(stateMap.get(INSTANCE_CONFIG_LIST.get(i).getInstanceName()).charAt(0)).append(
+              "\t\t");
+        } else {
           sb.append("-").append("\t\t");
         }
       }
@@ -261,31 +233,28 @@ public class Quickstart
     System.out.println("###################################################################");
   }
 
-  static final class MyProcess
-  {
+  static final class MyProcess {
     private final String instanceName;
     private HelixManager manager;
 
-    public MyProcess(String instanceName)
-    {
+    public MyProcess(String instanceName) {
       this.instanceName = instanceName;
     }
 
-    public void start() throws Exception
-    {
-      manager = HelixManagerFactory.getZKHelixManager(CLUSTER_NAME,
-          instanceName, InstanceType.PARTICIPANT, ZK_ADDRESS);
+    public void start() throws Exception {
+      manager =
+          HelixManagerFactory.getZKHelixManager(CLUSTER_NAME, instanceName,
+              InstanceType.PARTICIPANT, ZK_ADDRESS);
 
-      MasterSlaveStateModelFactory stateModelFactory = new MasterSlaveStateModelFactory(
-          instanceName);
+      MasterSlaveStateModelFactory stateModelFactory =
+          new MasterSlaveStateModelFactory(instanceName);
 
       StateMachineEngine stateMach = manager.getStateMachineEngine();
       stateMach.registerStateModelFactory(STATE_MODEL_NAME, stateModelFactory);
       manager.connect();
     }
 
-    public void stop()
-    {
+    public void stop() {
       manager.disconnect();
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/healthcheck/AccumulateAggregationType.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/healthcheck/AccumulateAggregationType.java b/helix-core/src/main/java/org/apache/helix/healthcheck/AccumulateAggregationType.java
index eaec3a9..a3c443f 100644
--- a/helix-core/src/main/java/org/apache/helix/healthcheck/AccumulateAggregationType.java
+++ b/helix-core/src/main/java/org/apache/helix/healthcheck/AccumulateAggregationType.java
@@ -21,23 +21,19 @@ package org.apache.helix.healthcheck;
 
 import org.apache.log4j.Logger;
 
-public class AccumulateAggregationType implements AggregationType
-{
+public class AccumulateAggregationType implements AggregationType {
 
-  private static final Logger logger = Logger
-      .getLogger(AccumulateAggregationType.class);
+  private static final Logger logger = Logger.getLogger(AccumulateAggregationType.class);
 
   public final static String TYPE_NAME = "accumulate";
 
   @Override
-  public String getName()
-  {
+  public String getName() {
     return TYPE_NAME;
   }
 
   @Override
-  public String merge(String iv, String ev, long prevTimestamp)
-  {
+  public String merge(String iv, String ev, long prevTimestamp) {
     double inVal = Double.parseDouble(iv);
     double existingVal = Double.parseDouble(ev);
     return String.valueOf(inVal + existingVal);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationType.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationType.java b/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationType.java
index cda4ef6..29f5921 100644
--- a/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationType.java
+++ b/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationType.java
@@ -19,15 +19,13 @@ package org.apache.helix.healthcheck;
  * under the License.
  */
 
-public interface AggregationType
-{
+public interface AggregationType {
 
   // public abstract <T extends Object> T merge(T iv, T ev);
 
   public final static String DELIM = "#";
 
-  public abstract String merge(String incomingVal, String existingVal,
-      long prevTimestamp);
+  public abstract String merge(String incomingVal, String existingVal, long prevTimestamp);
 
   public abstract String getName();
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationTypeFactory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationTypeFactory.java b/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationTypeFactory.java
index 726a792..d946641 100644
--- a/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationTypeFactory.java
+++ b/helix-core/src/main/java/org/apache/helix/healthcheck/AggregationTypeFactory.java
@@ -23,21 +23,16 @@ import java.util.StringTokenizer;
 
 import org.apache.log4j.Logger;
 
-public class AggregationTypeFactory
-{
-  private static final Logger logger = Logger
-      .getLogger(AggregationTypeFactory.class);
+public class AggregationTypeFactory {
+  private static final Logger logger = Logger.getLogger(AggregationTypeFactory.class);
 
-  public AggregationTypeFactory()
-  {
+  public AggregationTypeFactory() {
   }
 
   // TODO: modify this function so that it takes a single string, but can parse
   // apart params from type
-  public static AggregationType getAggregationType(String input)
-  {
-    if (input == null)
-    {
+  public static AggregationType getAggregationType(String input) {
+    if (input == null) {
       logger.error("AggregationType name is null");
       return null;
     }
@@ -45,41 +40,28 @@ public class AggregationTypeFactory
     String type = tok.nextToken();
     int numParams = tok.countTokens();
     String[] params = new String[numParams];
-    for (int i = 0; i < numParams; i++)
-    {
-      if (!tok.hasMoreTokens())
-      {
+    for (int i = 0; i < numParams; i++) {
+      if (!tok.hasMoreTokens()) {
         logger.error("Trying to parse non-existent params");
         return null;
       }
       params[i] = tok.nextToken();
     }
 
-    if (type.equals(AccumulateAggregationType.TYPE_NAME))
-    {
+    if (type.equals(AccumulateAggregationType.TYPE_NAME)) {
       return new AccumulateAggregationType();
-    }
-    else if (type.equals(DecayAggregationType.TYPE_NAME))
-    {
-      if (params.length < 1)
-      {
-        logger
-            .error("DecayAggregationType must contain <decay weight> parameter");
+    } else if (type.equals(DecayAggregationType.TYPE_NAME)) {
+      if (params.length < 1) {
+        logger.error("DecayAggregationType must contain <decay weight> parameter");
         return null;
       }
       return new DecayAggregationType(Double.parseDouble(params[0]));
-    }
-    else if (type.equals(WindowAggregationType.TYPE_NAME))
-    {
-      if (params.length < 1)
-      {
-        logger
-            .error("WindowAggregationType must contain <window size> parameter");
+    } else if (type.equals(WindowAggregationType.TYPE_NAME)) {
+      if (params.length < 1) {
+        logger.error("WindowAggregationType must contain <window size> parameter");
       }
       return new WindowAggregationType(Integer.parseInt(params[0]));
-    }
-    else
-    {
+    } else {
       logger.error("Unknown AggregationType " + type);
       return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/healthcheck/DecayAggregationType.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/healthcheck/DecayAggregationType.java b/helix-core/src/main/java/org/apache/helix/healthcheck/DecayAggregationType.java
index 2ace6c4..34e449a 100644
--- a/helix-core/src/main/java/org/apache/helix/healthcheck/DecayAggregationType.java
+++ b/helix-core/src/main/java/org/apache/helix/healthcheck/DecayAggregationType.java
@@ -21,25 +21,21 @@ package org.apache.helix.healthcheck;
 
 import org.apache.log4j.Logger;
 
-public class DecayAggregationType implements AggregationType
-{
+public class DecayAggregationType implements AggregationType {
 
-  private static final Logger logger = Logger
-      .getLogger(DecayAggregationType.class);
+  private static final Logger logger = Logger.getLogger(DecayAggregationType.class);
 
   public final static String TYPE_NAME = "decay";
 
   double _decayFactor = 0.1;
 
-  public DecayAggregationType(double df)
-  {
+  public DecayAggregationType(double df) {
     super();
     _decayFactor = df;
   }
 
   @Override
-  public String getName()
-  {
+  public String getName() {
     StringBuilder sb = new StringBuilder();
     sb.append(TYPE_NAME);
     sb.append(DELIM);
@@ -48,8 +44,7 @@ public class DecayAggregationType implements AggregationType
   }
 
   @Override
-  public String merge(String iv, String ev, long prevTimestamp)
-  {
+  public String merge(String iv, String ev, long prevTimestamp) {
     double incomingVal = Double.parseDouble(iv);
     double existingVal = Double.parseDouble(ev);
     long currTimestamp = System.currentTimeMillis();
@@ -58,7 +53,6 @@ public class DecayAggregationType implements AggregationType
     // decays
     double oldDecayCoeff = Math.pow((1 - _decayFactor), minutesOld);
     return String
-        .valueOf((double) (oldDecayCoeff * existingVal + (1 - oldDecayCoeff)
-            * incomingVal));
+        .valueOf((double) (oldDecayCoeff * existingVal + (1 - oldDecayCoeff) * incomingVal));
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultHealthReportProvider.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultHealthReportProvider.java b/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultHealthReportProvider.java
index 7909ce3..b7502f4 100644
--- a/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultHealthReportProvider.java
+++ b/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultHealthReportProvider.java
@@ -28,11 +28,8 @@ import java.util.TreeMap;
 import org.apache.helix.ZNRecord;
 import org.apache.log4j.Logger;
 
-
-class DefaultHealthReportProvider extends HealthReportProvider
-{
-  private static final Logger _logger = Logger
-      .getLogger(DefaultHealthReportProvider.class);
+class DefaultHealthReportProvider extends HealthReportProvider {
+  private static final Logger _logger = Logger.getLogger(DefaultHealthReportProvider.class);
 
   public final static String _availableCPUs = "availableCPUs";
   public final static String _freePhysicalMemory = "freePhysicalMemory";
@@ -40,32 +37,26 @@ class DefaultHealthReportProvider extends HealthReportProvider
   public final static String _freeJvmMemory = "freeJvmMemory";
   public final static String _averageSystemLoad = "averageSystemLoad";
 
-  public DefaultHealthReportProvider()
-  {
+  public DefaultHealthReportProvider() {
   }
 
   @Override
-  public Map<String, String> getRecentHealthReport()
-  {
-    OperatingSystemMXBean osMxBean = ManagementFactory
-        .getOperatingSystemMXBean();
+  public Map<String, String> getRecentHealthReport() {
+    OperatingSystemMXBean osMxBean = ManagementFactory.getOperatingSystemMXBean();
     long freeJvmMemory = Runtime.getRuntime().freeMemory();
     long totalJvmMemory = Runtime.getRuntime().totalMemory();
     int availableCPUs = osMxBean.getAvailableProcessors();
     double avgSystemLoad = osMxBean.getSystemLoadAverage();
     long freePhysicalMemory = Long.MAX_VALUE;
 
-    try
-    {
+    try {
       // if( osMxBean instanceof com.sun.management.OperatingSystemMXBean)
       // {
       // com.sun.management.OperatingSystemMXBean sunOsMxBean
       // = (com.sun.management.OperatingSystemMXBean) osMxBean;
       // freePhysicalMemory = sunOsMxBean.getFreePhysicalMemorySize();
       // }
-    }
-    catch (Throwable t)
-    {
+    } catch (Throwable t) {
       _logger.error(t);
     }
 
@@ -81,18 +72,16 @@ class DefaultHealthReportProvider extends HealthReportProvider
   }
 
   @Override
-  public Map<String, Map<String, String>> getRecentPartitionHealthReport()
-  {
+  public Map<String, Map<String, String>> getRecentPartitionHealthReport() {
     Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>();
-    
+
     result.put(getReportName(), getRecentHealthReport());
     return result;
   }
 
   @Override
-  public void resetStats()
-  {
+  public void resetStats() {
     // TODO Auto-generated method stub
 
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultPerfCounters.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultPerfCounters.java b/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultPerfCounters.java
index 561966e..e1afd5c 100644
--- a/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultPerfCounters.java
+++ b/helix-core/src/main/java/org/apache/helix/healthcheck/DefaultPerfCounters.java
@@ -24,12 +24,9 @@ import java.util.Date;
 import org.apache.helix.ZNRecord;
 import org.apache.log4j.Logger;
 
-
 @Deprecated
-public class DefaultPerfCounters extends ZNRecord
-{
-  private static final Logger _logger = Logger
-      .getLogger(DefaultPerfCounters.class);
+public class DefaultPerfCounters extends ZNRecord {
+  private static final Logger _logger = Logger.getLogger(DefaultPerfCounters.class);
 
   public final static String _availableCPUs = "availableCPUs";
   public final static String _freePhysicalMemory = "freePhysicalMemory";
@@ -37,10 +34,8 @@ public class DefaultPerfCounters extends ZNRecord
   public final static String _freeJvmMemory = "freeJvmMemory";
   public final static String _averageSystemLoad = "averageSystemLoad";
 
-  public DefaultPerfCounters(String instanceName, long availableCPUs,
-      long freePhysicalMemory, long freeJvmMemory, long totalJvmMemory,
-      double averageSystemLoad)
-  {
+  public DefaultPerfCounters(String instanceName, long availableCPUs, long freePhysicalMemory,
+      long freeJvmMemory, long totalJvmMemory, double averageSystemLoad) {
     super("DefaultPerfCounters");
     setSimpleField("instanceName", instanceName);
     setSimpleField("createTime", new Date().toString());
@@ -52,62 +47,47 @@ public class DefaultPerfCounters extends ZNRecord
     setSimpleField(_averageSystemLoad, "" + averageSystemLoad);
   }
 
-  public long getAvailableCpus()
-  {
+  public long getAvailableCpus() {
     return getSimpleLongVal(_availableCPUs);
   }
 
-  public double getAverageSystemLoad()
-  {
+  public double getAverageSystemLoad() {
     return getSimpleDoubleVal(_averageSystemLoad);
   }
 
-  public long getTotalJvmMemory()
-  {
+  public long getTotalJvmMemory() {
     return getSimpleLongVal(_totalJvmMemory);
   }
 
-  public long getFreeJvmMemory()
-  {
+  public long getFreeJvmMemory() {
     return getSimpleLongVal(_freeJvmMemory);
   }
 
-  public long getFreePhysicalMemory()
-  {
+  public long getFreePhysicalMemory() {
     return getSimpleLongVal(_freePhysicalMemory);
   }
 
-  long getSimpleLongVal(String key)
-  {
+  long getSimpleLongVal(String key) {
     String strVal = getSimpleField(key);
-    if (strVal == null)
-    {
+    if (strVal == null) {
       return 0;
     }
-    try
-    {
+    try {
       return Long.parseLong(strVal);
-    }
-    catch (Exception e)
-    {
+    } catch (Exception e) {
       _logger.warn(e);
       return 0;
     }
   }
 
-  double getSimpleDoubleVal(String key)
-  {
+  double getSimpleDoubleVal(String key) {
     String strVal = getSimpleField(key);
-    if (strVal == null)
-    {
+    if (strVal == null) {
       return 0;
     }
-    try
-    {
+    try {
       return Double.parseDouble(strVal);
-    }
-    catch (Exception e)
-    {
+    } catch (Exception e) {
       _logger.warn(e);
       return 0;
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/healthcheck/HealthReportProvider.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/healthcheck/HealthReportProvider.java b/helix-core/src/main/java/org/apache/helix/healthcheck/HealthReportProvider.java
index d445f80..f7afd04 100644
--- a/helix-core/src/main/java/org/apache/helix/healthcheck/HealthReportProvider.java
+++ b/helix-core/src/main/java/org/apache/helix/healthcheck/HealthReportProvider.java
@@ -21,21 +21,18 @@ package org.apache.helix.healthcheck;
 
 import java.util.Map;
 
-public abstract class HealthReportProvider
-{
+public abstract class HealthReportProvider {
   public static final String _defaultPerfCounters = "defaultPerfCounters";
 
   public abstract Map<String, String> getRecentHealthReport();
 
-  public Map<String, Map<String, String>> getRecentPartitionHealthReport()
-  {
+  public Map<String, Map<String, String>> getRecentPartitionHealthReport() {
     return null;
   }
 
   public abstract void resetStats();
 
-  public String getReportName()
-  {
+  public String getReportName() {
     return _defaultPerfCounters;
   }
 


Mime
View raw message