helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject [32/51] [partial] [HELIX-198] Unify helix code style, rb=13710
Date Wed, 21 Aug 2013 20:43:45 GMT
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskExecutor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskExecutor.java b/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskExecutor.java
index cd74505..600a3ab 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskExecutor.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskExecutor.java
@@ -56,125 +56,99 @@ import org.apache.helix.participant.HelixStateMachineEngine;
 import org.apache.helix.util.StatusUpdateUtil;
 import org.apache.log4j.Logger;
 
-
-public class HelixTaskExecutor implements MessageListener, TaskExecutor
-{
+public class HelixTaskExecutor implements MessageListener, TaskExecutor {
   // TODO: we need to further design how to throttle this.
   // From storage point of view, only bootstrap case is expensive
   // and we need to throttle, which is mostly IO / network bounded.
-  public static final int                                DEFAULT_PARALLEL_TASKS     = 40;
+  public static final int DEFAULT_PARALLEL_TASKS = 40;
   // TODO: create per-task type threadpool with customizable pool size
-  protected final Map<String, MessageTaskInfo>   _taskMap;
-  private final Object                                   _lock;
-  private final StatusUpdateUtil                         _statusUpdateUtil;
-  private final ParticipantMonitor                       _monitor;
-  public static final String                             MAX_THREADS                =
-                                                                                        "maxThreads";
+  protected final Map<String, MessageTaskInfo> _taskMap;
+  private final Object _lock;
+  private final StatusUpdateUtil _statusUpdateUtil;
+  private final ParticipantMonitor _monitor;
+  public static final String MAX_THREADS = "maxThreads";
 
-  final ConcurrentHashMap<String, MessageHandlerFactory> _handlerFactoryMap         =
-                                                                                        new ConcurrentHashMap<String, MessageHandlerFactory>();
+  final ConcurrentHashMap<String, MessageHandlerFactory> _handlerFactoryMap =
+      new ConcurrentHashMap<String, MessageHandlerFactory>();
 
-  final ConcurrentHashMap<String, ExecutorService>       _executorMap;
+  final ConcurrentHashMap<String, ExecutorService> _executorMap;
 
-  private static Logger                                  LOG                        =
-                                                                                        Logger.getLogger(HelixTaskExecutor.class);
+  private static Logger LOG = Logger.getLogger(HelixTaskExecutor.class);
 
-  Map<String, Integer>                                   _resourceThreadpoolSizeMap =
-                                                                                        new ConcurrentHashMap<String, Integer>();
+  Map<String, Integer> _resourceThreadpoolSizeMap = new ConcurrentHashMap<String, Integer>();
 
   // timer for schedule timeout tasks
   final Timer _timer;
 
-
-  public HelixTaskExecutor()
-  {
+  public HelixTaskExecutor() {
     _taskMap = new ConcurrentHashMap<String, MessageTaskInfo>();
     _executorMap = new ConcurrentHashMap<String, ExecutorService>();
 
     _lock = new Object();
     _statusUpdateUtil = new StatusUpdateUtil();
     _monitor = new ParticipantMonitor();
-    
+
     _timer = new Timer(true); // created as a daemon timer thread to handle task timeout
 
     startMonitorThread();
   }
 
   @Override
-  public void registerMessageHandlerFactory(String type, MessageHandlerFactory factory)
-  {
+  public void registerMessageHandlerFactory(String type, MessageHandlerFactory factory) {
     registerMessageHandlerFactory(type, factory, DEFAULT_PARALLEL_TASKS);
   }
 
   @Override
-  public void registerMessageHandlerFactory(String type,
-                                            MessageHandlerFactory factory,
-                                            int threadpoolSize)
-  {
-    if (!_handlerFactoryMap.containsKey(type))
-    {
-      if (!type.equalsIgnoreCase(factory.getMessageType()))
-      {
-        throw new HelixException("Message factory type mismatch. Type: " + type
-            + " factory : " + factory.getMessageType());
+  public void registerMessageHandlerFactory(String type, MessageHandlerFactory factory,
+      int threadpoolSize) {
+    if (!_handlerFactoryMap.containsKey(type)) {
+      if (!type.equalsIgnoreCase(factory.getMessageType())) {
+        throw new HelixException("Message factory type mismatch. Type: " + type + " factory : "
+            + factory.getMessageType());
 
       }
       _handlerFactoryMap.put(type, factory);
       ExecutorService executorSvc = Executors.newFixedThreadPool(threadpoolSize);
       _executorMap.put(type, executorSvc);
-      
-      LOG.info("Added msg-factory for type: " + type + ", threadpool size "
-          + threadpoolSize);
-    }
-    else
-    {
-      LOG.warn("Fail to register msg-handler-factory for type: " + type 
-          + ", pool-size: " + threadpoolSize + ", factory: " + factory);
+
+      LOG.info("Added msg-factory for type: " + type + ", threadpool size " + threadpoolSize);
+    } else {
+      LOG.warn("Fail to register msg-handler-factory for type: " + type + ", pool-size: "
+          + threadpoolSize + ", factory: " + factory);
     }
   }
 
-  public ParticipantMonitor getParticipantMonitor()
-  {
+  public ParticipantMonitor getParticipantMonitor() {
     return _monitor;
   }
 
-  private void startMonitorThread()
-  {
+  private void startMonitorThread() {
     // start a thread which monitors the completions of task
   }
 
-  void checkResourceConfig(String resourceName, HelixManager manager)
-  {
-    if (!_resourceThreadpoolSizeMap.containsKey(resourceName))
-    {
+  void checkResourceConfig(String resourceName, HelixManager manager) {
+    if (!_resourceThreadpoolSizeMap.containsKey(resourceName)) {
       int threadpoolSize = -1;
       ConfigAccessor configAccessor = manager.getConfigAccessor();
-      if (configAccessor != null)
-      {
+      if (configAccessor != null) {
         ConfigScope scope =
-            new ConfigScopeBuilder().forCluster(manager.getClusterName())
-                                    .forResource(resourceName)
-                                    .build();
+            new ConfigScopeBuilder().forCluster(manager.getClusterName()).forResource(resourceName)
+                .build();
 
         String threadpoolSizeStr = configAccessor.get(scope, MAX_THREADS);
-        try
-        {
-          if (threadpoolSizeStr != null)
-          {
+        try {
+          if (threadpoolSizeStr != null) {
             threadpoolSize = Integer.parseInt(threadpoolSizeStr);
           }
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
           LOG.error("", e);
         }
       }
-      if (threadpoolSize > 0)
-      {
+      if (threadpoolSize > 0) {
         String key = MessageType.STATE_TRANSITION.toString() + "." + resourceName;
         _executorMap.put(key, Executors.newFixedThreadPool(threadpoolSize));
-        LOG.info("Added per resource threadpool for resource: " + resourceName
-            + " with size: " + threadpoolSize);
+        LOG.info("Added per resource threadpool for resource: " + resourceName + " with size: "
+            + threadpoolSize);
       }
       _resourceThreadpoolSizeMap.put(resourceName, threadpoolSize);
     }
@@ -183,19 +157,14 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
   /**
    * Find the executor service for the message. A message can have a per-statemodelfactory
    * executor service, or per-message type executor service.
-   * 
    **/
-  ExecutorService findExecutorServiceForMsg(Message message)
-  {
+  ExecutorService findExecutorServiceForMsg(Message message) {
     ExecutorService executorService = _executorMap.get(message.getMsgType());
-    if (message.getMsgType().equals(MessageType.STATE_TRANSITION.toString()))
-    {
+    if (message.getMsgType().equals(MessageType.STATE_TRANSITION.toString())) {
       String resourceName = message.getResourceName();
-      if (resourceName != null)
-      {
+      if (resourceName != null) {
         String key = message.getMsgType() + "." + resourceName;
-        if (_executorMap.containsKey(key))
-        {
+        if (_executorMap.containsKey(key)) {
           LOG.info("Find per-resource thread pool with key: " + key);
           executorService = _executorMap.get(key);
         }
@@ -206,12 +175,12 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
 
   // ExecutorService impl's in JDK are thread-safe
   @Override
-  public List<Future<HelixTaskResult>> invokeAllTasks(List<MessageTask> tasks, long timeout, TimeUnit unit) throws InterruptedException
-  {
+  public List<Future<HelixTaskResult>> invokeAllTasks(List<MessageTask> tasks, long timeout,
+      TimeUnit unit) throws InterruptedException {
     if (tasks == null || tasks.size() == 0) {
       return null;
     }
-    
+
     // check all tasks use the same executor-service
     ExecutorService exeSvc = findExecutorServiceForMsg(tasks.get(0).getMessage());
     for (int i = 1; i < tasks.size(); i++) {
@@ -222,198 +191,154 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
         return null;
       }
     }
-    
+
     // TODO: check if any of the task has already been scheduled
-        
+
     // this is a blocking call
-      List<Future<HelixTaskResult>> futures = exeSvc.invokeAll(tasks, timeout, unit);
-      
-      return futures;
+    List<Future<HelixTaskResult>> futures = exeSvc.invokeAll(tasks, timeout, unit);
+
+    return futures;
   }
 
   @Override
-  public boolean cancelTimeoutTask(MessageTask task)
-  {
-    synchronized(_lock) {
+  public boolean cancelTimeoutTask(MessageTask task) {
+    synchronized (_lock) {
       String taskId = task.getTaskId();
-          if (_taskMap.containsKey(taskId)) {
-            MessageTaskInfo info = _taskMap.get(taskId);
-            if (info._timerTask != null) {
-              info._timerTask.cancel();
-            }
-            return true;
-          }
-          return false;
+      if (_taskMap.containsKey(taskId)) {
+        MessageTaskInfo info = _taskMap.get(taskId);
+        if (info._timerTask != null) {
+          info._timerTask.cancel();
+        }
+        return true;
+      }
+      return false;
     }
   }
-  
-  @Override 
-  public boolean scheduleTask(MessageTask task)
-  {
+
+  @Override
+  public boolean scheduleTask(MessageTask task) {
     String taskId = task.getTaskId();
     Message message = task.getMessage();
     NotificationContext notificationContext = task.getNotificationContext();
 
-    
-    try 
-    {
-        if (message.getMsgType().equals(MessageType.STATE_TRANSITION.toString()))
-        {
-          checkResourceConfig(message.getResourceName(), notificationContext.getManager());
-        }
-        
-        LOG.info("Scheduling message: " + taskId);
-        // System.out.println("sched msg: " + message.getPartitionName() + "-"
-        // + message.getTgtName() + "-" + message.getFromState() + "-"
-        // + message.getToState());
-
-        _statusUpdateUtil.logInfo(message,
-                                  HelixTaskExecutor.class,
-                                  "Message handling task scheduled",
-                                  notificationContext.getManager().getHelixDataAccessor());
-        
-        // this sync guarantees that ExecutorService.submit() task and put taskInfo into map are sync'ed
-        synchronized (_lock)
-        {
-          if (!_taskMap.containsKey(taskId))
-          {
-            ExecutorService exeSvc = findExecutorServiceForMsg(message);
+    try {
+      if (message.getMsgType().equals(MessageType.STATE_TRANSITION.toString())) {
+        checkResourceConfig(message.getResourceName(), notificationContext.getManager());
+      }
+
+      LOG.info("Scheduling message: " + taskId);
+      // System.out.println("sched msg: " + message.getPartitionName() + "-"
+      // + message.getTgtName() + "-" + message.getFromState() + "-"
+      // + message.getToState());
+
+      _statusUpdateUtil.logInfo(message, HelixTaskExecutor.class,
+          "Message handling task scheduled", notificationContext.getManager()
+              .getHelixDataAccessor());
+
+      // this sync guarantees that ExecutorService.submit() task and put taskInfo into map are
+      // sync'ed
+      synchronized (_lock) {
+        if (!_taskMap.containsKey(taskId)) {
+          ExecutorService exeSvc = findExecutorServiceForMsg(message);
           Future<HelixTaskResult> future = exeSvc.submit(task);
-          
-            TimerTask timerTask = null;
-            if (message.getExecutionTimeout() > 0)
-            {
-              timerTask = new MessageTimeoutTask(this, task);
-              _timer.schedule(timerTask, message.getExecutionTimeout());
-              LOG.info("Message starts with timeout " + message.getExecutionTimeout()
-                  + " MsgId: " + task.getTaskId());
-            }
-            else
-            {
-              LOG.debug("Message does not have timeout. MsgId: " + task.getTaskId());
-            }
+
+          TimerTask timerTask = null;
+          if (message.getExecutionTimeout() > 0) {
+            timerTask = new MessageTimeoutTask(this, task);
+            _timer.schedule(timerTask, message.getExecutionTimeout());
+            LOG.info("Message starts with timeout " + message.getExecutionTimeout() + " MsgId: "
+                + task.getTaskId());
+          } else {
+            LOG.debug("Message does not have timeout. MsgId: " + task.getTaskId());
+          }
 
           _taskMap.put(taskId, new MessageTaskInfo(task, future, timerTask));
 
-            LOG.info("Message: " + taskId + " handling task scheduled");
+          LOG.info("Message: " + taskId + " handling task scheduled");
 
-            return true;
-          }
-          else
-          {
-            _statusUpdateUtil.logWarning(message,
-                                       HelixTaskExecutor.class,
-                                       "Message handling task already sheduled for "
-                                           + taskId,
-                                       notificationContext.getManager()
-                                                          .getHelixDataAccessor());
-          }
+          return true;
+        } else {
+          _statusUpdateUtil.logWarning(message, HelixTaskExecutor.class,
+              "Message handling task already sheduled for " + taskId, notificationContext
+                  .getManager().getHelixDataAccessor());
         }
       }
-      catch (Exception e)
-      {
-        LOG.error("Error while executing task. " + message, e);
-
-        _statusUpdateUtil.logError(message,
-                                   HelixTaskExecutor.class,
-                                   e,
-                                   "Error while executing task " + e,
-                                   notificationContext.getManager()
-                                                      .getHelixDataAccessor());
-      }
-      return false;
+    } catch (Exception e) {
+      LOG.error("Error while executing task. " + message, e);
+
+      _statusUpdateUtil.logError(message, HelixTaskExecutor.class, e, "Error while executing task "
+          + e, notificationContext.getManager().getHelixDataAccessor());
+    }
+    return false;
   }
 
   @Override
-  public boolean cancelTask(MessageTask task)
-  {
-      Message message = task.getMessage();
-      NotificationContext notificationContext = task.getNotificationContext();
-      String taskId = task.getTaskId();
+  public boolean cancelTask(MessageTask task) {
+    Message message = task.getMessage();
+    NotificationContext notificationContext = task.getNotificationContext();
+    String taskId = task.getTaskId();
 
-      synchronized(_lock) 
-      {
-        if (_taskMap.containsKey(taskId))
-        {
-          MessageTaskInfo taskInfo = _taskMap.get(taskId);
+    synchronized (_lock) {
+      if (_taskMap.containsKey(taskId)) {
+        MessageTaskInfo taskInfo = _taskMap.get(taskId);
         // cancel timeout task
-          if (taskInfo._timerTask != null) {
-            taskInfo._timerTask.cancel();
-          }
+        if (taskInfo._timerTask != null) {
+          taskInfo._timerTask.cancel();
+        }
 
         // cancel task
-          Future<HelixTaskResult> future = taskInfo.getFuture();
-
-          _statusUpdateUtil.logInfo(message,
-                                  HelixTaskExecutor.class,
-                                  "Canceling task: " + taskId,
-                                  notificationContext.getManager().getHelixDataAccessor());
-
-          // If the thread is still running it will be interrupted if cancel(true)
-          // is called. So state transition callbacks should implement logic to
-          // return
-          // if it is interrupted.
-          if (future.cancel(true))
-          {
-            _statusUpdateUtil.logInfo(message, HelixTaskExecutor.class, "Canceled task: "
+        Future<HelixTaskResult> future = taskInfo.getFuture();
+
+        _statusUpdateUtil.logInfo(message, HelixTaskExecutor.class, "Canceling task: " + taskId,
+            notificationContext.getManager().getHelixDataAccessor());
+
+        // If the thread is still running it will be interrupted if cancel(true)
+        // is called. So state transition callbacks should implement logic to
+        // return
+        // if it is interrupted.
+        if (future.cancel(true)) {
+          _statusUpdateUtil.logInfo(message, HelixTaskExecutor.class, "Canceled task: " + taskId,
+              notificationContext.getManager().getHelixDataAccessor());
+          _taskMap.remove(taskId);
+          return true;
+        } else {
+          _statusUpdateUtil.logInfo(message, HelixTaskExecutor.class, "fail to cancel task: "
               + taskId, notificationContext.getManager().getHelixDataAccessor());
-            _taskMap.remove(taskId);
-            return true;
-          }
-          else
-          {
-            _statusUpdateUtil.logInfo(message,
-                                    HelixTaskExecutor.class,
-                                    "fail to cancel task: " + taskId,
-                                    notificationContext.getManager()
-                                                       .getHelixDataAccessor());
-          }
-        }
-        else
-        {
-          _statusUpdateUtil.logWarning(message,
-                                     HelixTaskExecutor.class,
-                                     "fail to cancel task: " + taskId + ", future not found",
-                                     notificationContext.getManager()
-                                                        .getHelixDataAccessor());
         }
+      } else {
+        _statusUpdateUtil.logWarning(message, HelixTaskExecutor.class, "fail to cancel task: "
+            + taskId + ", future not found", notificationContext.getManager()
+            .getHelixDataAccessor());
       }
-      return false;
+    }
+    return false;
   }
 
   @Override
-  public void finishTask(MessageTask task)
-  {
-  Message message = task.getMessage();
+  public void finishTask(MessageTask task) {
+    Message message = task.getMessage();
     String taskId = task.getTaskId();
     LOG.info("message finished: " + taskId + ", took "
-            + (new Date().getTime() - message.getExecuteStartTimeStamp()));
-
-    synchronized (_lock)
-    {
-      if (_taskMap.containsKey(taskId))
-      {
-          MessageTaskInfo info = _taskMap.remove(taskId);
-          if (info._timerTask != null) {
-            // ok to cancel multiple times
-            info._timerTask.cancel();
-          }
-      }
-      else
-      {
+        + (new Date().getTime() - message.getExecuteStartTimeStamp()));
+
+    synchronized (_lock) {
+      if (_taskMap.containsKey(taskId)) {
+        MessageTaskInfo info = _taskMap.remove(taskId);
+        if (info._timerTask != null) {
+          // ok to cancel multiple times
+          info._timerTask.cancel();
+        }
+      } else {
         LOG.warn("message " + taskId + " not found in task map");
       }
     }
   }
 
-  private void updateMessageState(List<Message> readMsgs,
-                                  HelixDataAccessor accessor,
-                                  String instanceName)
-  {
+  private void updateMessageState(List<Message> readMsgs, HelixDataAccessor accessor,
+      String instanceName) {
     Builder keyBuilder = accessor.keyBuilder();
     List<PropertyKey> readMsgKeys = new ArrayList<PropertyKey>();
-    for (Message msg : readMsgs)
-    {
+    for (Message msg : readMsgs) {
       readMsgKeys.add(msg.getKey(keyBuilder, instanceName));
     }
     accessor.setChildren(readMsgKeys, readMsgs);
@@ -421,7 +346,6 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
 
   /**
    * remove message-handler factory from map, shutdown the associated executor
-   * 
    * @param type
    */
   void unregisterMessageHandlerFactory(String type) {
@@ -429,11 +353,11 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
     ExecutorService executorSvc = _executorMap.remove(type);
     if (executorSvc != null) {
       List<Runnable> tasksLeft = executorSvc.shutdownNow();
-      LOG.info(tasksLeft.size() + " tasks never executed for msgType: "
-          + type + ". tasks: " + tasksLeft);
+      LOG.info(tasksLeft.size() + " tasks never executed for msgType: " + type + ". tasks: "
+          + tasksLeft);
       try {
         if (!executorSvc.awaitTermination(200, TimeUnit.MILLISECONDS)) {
-          LOG.error("executor-service for msgType: " + type 
+          LOG.error("executor-service for msgType: " + type
               + " is not fully terminated in 200ms. will disconnect helix-participant");
           throw new HelixException("fail to unregister msg-handler for msgType: " + type);
         }
@@ -441,42 +365,37 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
         LOG.error("interruped when waiting for executor-service shutdown for msgType: " + type, e);
       }
     }
-    
+
     // reset state-model
     MessageHandlerFactory handlerFty = _handlerFactoryMap.remove(type);
     if (handlerFty != null) {
       handlerFty.reset();
     }
   }
-  
+
   void reset() {
     LOG.info("Get FINALIZE notification");
-    for (String msgType : _executorMap.keySet())
-    {
+    for (String msgType : _executorMap.keySet()) {
       unregisterMessageHandlerFactory(msgType);
     }
-    
+
     // clear task-map, all tasks should be terminated by now
     _taskMap.clear();
-            
+
   }
-  
+
   @Override
-  public void onMessage(String instanceName,
-                        List<Message> messages,
-                        NotificationContext changeContext)
-  {
+  public void onMessage(String instanceName, List<Message> messages,
+      NotificationContext changeContext) {
     // If FINALIZE notification comes, reset all handler factories
     // and terminate all the thread pools
     // TODO: see if we should have a separate notification call for resetting
-    if (changeContext.getType() == Type.FINALIZE)
-    {
+    if (changeContext.getType() == Type.FINALIZE) {
       reset();
       return;
     }
 
-    if (messages == null || messages.size() == 0)
-    {
+    if (messages == null || messages.size() == 0) {
       LOG.info("No Messages to process");
       return;
     }
@@ -501,12 +420,10 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
     List<CurrentState> metaCurStates = new ArrayList<CurrentState>();
     Set<String> createCurStateNames = new HashSet<String>();
 
-    for (Message message : messages)
-    {
+    for (Message message : messages) {
       // nop messages are simply removed. It is used to trigger onMessage() in
       // situations such as register a new message handler factory
-      if (message.getMsgType().equalsIgnoreCase(MessageType.NO_OP.toString()))
-      {
+      if (message.getMsgType().equalsIgnoreCase(MessageType.NO_OP.toString())) {
         LOG.info("Dropping NO-OP message. mid: " + message.getId() + ", from: "
             + message.getMsgSrc());
         accessor.removeProperty(message.getKey(keyBuilder, instanceName));
@@ -516,56 +433,43 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
       String tgtSessionId = message.getTgtSessionId();
 
       // sessionId mismatch normally means message comes from expired session, just remove it
-      if (!sessionId.equals(tgtSessionId) && !tgtSessionId.equals("*"))
-      {
+      if (!sessionId.equals(tgtSessionId) && !tgtSessionId.equals("*")) {
         String warningMessage =
             "SessionId does NOT match. expected sessionId: " + sessionId
                 + ", tgtSessionId in message: " + tgtSessionId + ", messageId: "
                 + message.getMsgId();
         LOG.warn(warningMessage);
         accessor.removeProperty(message.getKey(keyBuilder, instanceName));
-        _statusUpdateUtil.logWarning(message,
-                                     HelixStateMachineEngine.class,
-                                     warningMessage,
-                                     accessor);
+        _statusUpdateUtil.logWarning(message, HelixStateMachineEngine.class, warningMessage,
+            accessor);
         continue;
       }
 
       // don't process message that is of READ or UNPROCESSABLE state
-      if (MessageState.NEW != message.getMsgState())
-      {
+      if (MessageState.NEW != message.getMsgState()) {
         // It happens because we don't delete message right after
         // read. Instead we keep it until the current state is updated.
         // We will read the message again if there is a new message but we
         // check for the status and ignore if its already read
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("Message already read. msgId: " + message.getMsgId());
-      }
+        if (LOG.isTraceEnabled()) {
+          LOG.trace("Message already read. msgId: " + message.getMsgId());
+        }
         continue;
       }
 
       // create message handlers, if handlers not found, leave its state as NEW
-      try
-      {
+      try {
         MessageHandler createHandler = createMessageHandler(message, changeContext);
-        if (createHandler == null)
-        {
+        if (createHandler == null) {
           continue;
         }
         handlers.add(createHandler);
-      }
-      catch (Exception e)
-      {
+      } catch (Exception e) {
         LOG.error("Failed to create message handler for " + message.getMsgId(), e);
         String error =
-            "Failed to create message handler for " + message.getMsgId()
-                + ", exception: " + e;
+            "Failed to create message handler for " + message.getMsgId() + ", exception: " + e;
 
-        _statusUpdateUtil.logError(message,
-                                   HelixStateMachineEngine.class,
-                                   e,
-                                   error,
-                                   accessor);
+        _statusUpdateUtil.logError(message, HelixStateMachineEngine.class, e, error, accessor);
 
         message.setMsgState(MessageState.UNPROCESSABLE);
         accessor.removeProperty(message.getKey(keyBuilder, instanceName));
@@ -579,26 +483,18 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
       message.setReadTimeStamp(new Date().getTime());
       message.setExecuteSessionId(changeContext.getManager().getSessionId());
 
-      _statusUpdateUtil.logInfo(message,
-                                HelixStateMachineEngine.class,
-                                "New Message",
-                                accessor);
+      _statusUpdateUtil.logInfo(message, HelixStateMachineEngine.class, "New Message", accessor);
 
       readMsgs.add(message);
 
       // batch creation of all current state meta data
       // do it for non-controller and state transition messages only
       if (!message.isControlerMsg()
-          && message.getMsgType().equals(Message.MessageType.STATE_TRANSITION.toString()))
-      {
+          && message.getMsgType().equals(Message.MessageType.STATE_TRANSITION.toString())) {
         String resourceName = message.getResourceName();
-        if (!curResourceNames.contains(resourceName)
-            && !createCurStateNames.contains(resourceName))
-        {
+        if (!curResourceNames.contains(resourceName) && !createCurStateNames.contains(resourceName)) {
           createCurStateNames.add(resourceName);
-          createCurStateKeys.add(keyBuilder.currentState(instanceName,
-                                                         sessionId,
-                                                         resourceName));
+          createCurStateKeys.add(keyBuilder.currentState(instanceName, sessionId, resourceName));
 
           CurrentState metaCurState = new CurrentState(resourceName);
           metaCurState.setBucketSize(message.getBucketSize());
@@ -606,12 +502,9 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
           metaCurState.setSessionId(sessionId);
           metaCurState.setBatchMessageMode(message.getBatchMessageMode());
           String ftyName = message.getStateModelFactoryName();
-          if (ftyName != null)
-          {
+          if (ftyName != null) {
             metaCurState.setStateModelFactoryName(ftyName);
-          }
-          else
-          {
+          } else {
             metaCurState.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
           }
 
@@ -621,34 +514,26 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
     }
 
     // batch create curState meta
-    if (createCurStateKeys.size() > 0)
-    {
-      try
-      {
+    if (createCurStateKeys.size() > 0) {
+      try {
         accessor.createChildren(createCurStateKeys, metaCurStates);
-      }
-      catch (Exception e)
-      {
+      } catch (Exception e) {
         LOG.error("fail to create cur-state znodes for messages: " + readMsgs, e);
       }
     }
 
     // update message state to READ in batch and schedule all read messages
-    if (readMsgs.size() > 0)
-    {
+    if (readMsgs.size() > 0) {
       updateMessageState(readMsgs, accessor, instanceName);
 
-      for (MessageHandler handler : handlers)
-      {
-          HelixTask task = new HelixTask(handler._message, changeContext, handler, this);
-          scheduleTask(task);
+      for (MessageHandler handler : handlers) {
+        HelixTask task = new HelixTask(handler._message, changeContext, handler, this);
+        scheduleTask(task);
       }
     }
   }
 
-  public MessageHandler createMessageHandler(Message message,
-                                              NotificationContext changeContext)
-  {
+  public MessageHandler createMessageHandler(Message message, NotificationContext changeContext) {
     String msgType = message.getMsgType().toString();
 
     MessageHandlerFactory handlerFactory = _handlerFactoryMap.get(msgType);
@@ -656,44 +541,35 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
     // Fail to find a MessageHandlerFactory for the message
     // we will keep the message and the message will be handled when
     // the corresponding MessageHandlerFactory is registered
-    if (handlerFactory == null)
-    {
+    if (handlerFactory == null) {
       LOG.warn("Fail to find message handler factory for type: " + msgType + " msgId: "
           + message.getMsgId());
       return null;
     }
 
-    // pass the executor to msg-handler since batch-msg-handler needs task-executor to schedule sub-msgs
+    // pass the executor to msg-handler since batch-msg-handler needs task-executor to schedule
+    // sub-msgs
     changeContext.add(MapKey.TASK_EXECUTOR.toString(), this);
     return handlerFactory.createHandler(message, changeContext);
   }
 
   @Override
-  public void shutdown()
-  {
+  public void shutdown() {
     LOG.info("shutting down TaskExecutor");
     _timer.cancel();
-    
-    synchronized (_lock)
-    {
-      for (String msgType : _executorMap.keySet())
-      {
+
+    synchronized (_lock) {
+      for (String msgType : _executorMap.keySet()) {
         List<Runnable> tasksLeft = _executorMap.get(msgType).shutdownNow();
-        LOG.info(tasksLeft.size() + " tasks are still in the threadpool for msgType "
-            + msgType);
+        LOG.info(tasksLeft.size() + " tasks are still in the threadpool for msgType " + msgType);
       }
-      for (String msgType : _executorMap.keySet())
-      {
-        try
-        {
-          if (!_executorMap.get(msgType).awaitTermination(200, TimeUnit.MILLISECONDS))
-          {
+      for (String msgType : _executorMap.keySet()) {
+        try {
+          if (!_executorMap.get(msgType).awaitTermination(200, TimeUnit.MILLISECONDS)) {
             LOG.warn(msgType + " is not fully termimated in 200 MS");
             System.out.println(msgType + " is not fully termimated in 200 MS");
           }
-        }
-        catch (InterruptedException e)
-        {
+        } catch (InterruptedException e) {
           LOG.error("Interrupted", e);
         }
       }
@@ -701,4 +577,4 @@ public class HelixTaskExecutor implements MessageListener, TaskExecutor
     _monitor.shutDown();
     LOG.info("shutdown finished");
   }
-}
\ 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/messaging/handling/HelixTaskResult.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskResult.java b/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskResult.java
index 1ccf28b..22c4fcd 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskResult.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/handling/HelixTaskResult.java
@@ -22,57 +22,47 @@ package org.apache.helix.messaging.handling;
 import java.util.HashMap;
 import java.util.Map;
 
-public class HelixTaskResult
-{
+public class HelixTaskResult {
 
   private boolean _success;
   private String _message = "";
   private Map<String, String> _taskResultMap = new HashMap<String, String>();
   private boolean _interrupted = false;
   Exception _exception = null;
-  
-  public boolean isSuccess()
-  {
+
+  public boolean isSuccess() {
     return _success;
   }
-  
-  public boolean isInterrupted()
-  {
-    return _interrupted; 
+
+  public boolean isInterrupted() {
+    return _interrupted;
   }
-  
-  public void setInterrupted(boolean interrupted)
-  {
+
+  public void setInterrupted(boolean interrupted) {
     _interrupted = interrupted;
   }
-  
-  public void setSuccess(boolean success)
-  {
+
+  public void setSuccess(boolean success) {
     this._success = success;
   }
 
-  public String getMessage()
-  {
+  public String getMessage() {
     return _message;
   }
 
-  public void setMessage(String message)
-  {
+  public void setMessage(String message) {
     this._message = message;
   }
-  
-  public Map<String, String> getTaskResultMap()
-  {
+
+  public Map<String, String> getTaskResultMap() {
     return _taskResultMap;
   }
-  
-  public void setException(Exception e)
-  {
+
+  public void setException(Exception e) {
     _exception = e;
   }
-  
-  public Exception getException()
-  {
+
+  public Exception getException() {
     return _exception;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandler.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandler.java b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandler.java
index fb7cf99..96784c2 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandler.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandler.java
@@ -25,64 +25,61 @@ import org.apache.helix.messaging.handling.MessageHandler.ErrorType;
 import org.apache.helix.model.Message;
 
 /**
- * Provides the base class for all message handlers. 
- * 
+ * Provides the base class for all message handlers.
  */
-public abstract class MessageHandler
-{
-  public enum ErrorType
-  {
-    FRAMEWORK, INTERNAL
+public abstract class MessageHandler {
+  public enum ErrorType {
+    FRAMEWORK,
+    INTERNAL
   }
-  
-  public enum ErrorCode
-  {
-    ERROR, CANCEL, TIMEOUT
+
+  public enum ErrorCode {
+    ERROR,
+    CANCEL,
+    TIMEOUT
   }
+
   /**
-   * The message to be handled 
+   * The message to be handled
    */
   protected final Message _message;
-  
+
   /**
    * The context for handling the message. The cluster manager interface can be
-   * accessed from NotificationContext 
+   * accessed from NotificationContext
    */
   protected final NotificationContext _notificationContext;
-  
+
   /**
    * The constructor. The message and notification context must be provided via
    * creation.
    */
-  public MessageHandler(Message message, NotificationContext context)
-  {
+  public MessageHandler(Message message, NotificationContext context) {
     _message = message;
     _notificationContext = context;
   }
-  
+
   /**
-   * Message handling routine. The function is called in a thread pool task in 
-   * CMTaskExecutor 
-   * 
+   * Message handling routine. The function is called in a thread pool task in
+   * CMTaskExecutor
    * @return returns the CMTaskResult which contains info about the message processing.
    */
-  public abstract HelixTaskResult handleMessage()  throws InterruptedException;
-  
+  public abstract HelixTaskResult handleMessage() throws InterruptedException;
+
   /**
-   * Callback when error happens in the message handling pipeline. 
+   * Callback when error happens in the message handling pipeline.
    * @param type TODO
-   * @param retryCountLeft - The number of retries that the framework will 
-   * continue trying to handle the message
-   * @param ErrorType - denote if the exception happens in framework or happens in the 
-   * customer's code
+   * @param retryCountLeft - The number of retries that the framework will
+   *          continue trying to handle the message
+   * @param ErrorType - denote if the exception happens in framework or happens in the
+   *          customer's code
    */
   public abstract void onError(Exception e, ErrorCode code, ErrorType type);
-  
+
   /**
-   * Callback when the framework is about to interrupt the message handler 
+   * Callback when the framework is about to interrupt the message handler
    */
-  public void onTimeout()
-  {
-    
+  public void onTimeout() {
+
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandlerFactory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandlerFactory.java b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandlerFactory.java
index da1c518..6811adc 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandlerFactory.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageHandlerFactory.java
@@ -22,11 +22,10 @@ package org.apache.helix.messaging.handling;
 import org.apache.helix.NotificationContext;
 import org.apache.helix.model.Message;
 
-public interface MessageHandlerFactory
-{
+public interface MessageHandlerFactory {
   MessageHandler createHandler(Message message, NotificationContext context);
-  
+
   String getMessageType();
-  
+
   void reset();
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTask.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTask.java b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTask.java
index 083d903..a17f8cc 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTask.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTask.java
@@ -25,12 +25,12 @@ import org.apache.helix.NotificationContext;
 import org.apache.helix.model.Message;
 
 public interface MessageTask extends Callable<HelixTaskResult> {
-	String getTaskId();
-	
-	Message getMessage();
-	
-	NotificationContext getNotificationContext();
-	
-	void onTimeout();
+  String getTaskId();
+
+  Message getMessage();
+
+  NotificationContext getNotificationContext();
+
+  void onTimeout();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTaskInfo.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTaskInfo.java b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTaskInfo.java
index 652ca21..28d028a 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTaskInfo.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTaskInfo.java
@@ -23,19 +23,18 @@ import java.util.TimerTask;
 import java.util.concurrent.Future;
 
 public class MessageTaskInfo {
-	final MessageTask _task;
-	final Future<HelixTaskResult> _future;
-	final TimerTask _timerTask;
-	
-	public MessageTaskInfo(MessageTask task, Future<HelixTaskResult> future, TimerTask timerTask)
-	{
-		_task = task;
-		_future = future;
-		_timerTask = timerTask;
-	}
+  final MessageTask _task;
+  final Future<HelixTaskResult> _future;
+  final TimerTask _timerTask;
+
+  public MessageTaskInfo(MessageTask task, Future<HelixTaskResult> future, TimerTask timerTask) {
+    _task = task;
+    _future = future;
+    _timerTask = timerTask;
+  }
+
+  public Future<HelixTaskResult> getFuture() {
+    return _future;
+  }
 
-	public Future<HelixTaskResult> getFuture() {
-		return _future;
-	}
-	
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTimeoutTask.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTimeoutTask.java b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTimeoutTask.java
index c89a7be..e1b4f0f 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTimeoutTask.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/handling/MessageTimeoutTask.java
@@ -25,26 +25,25 @@ import org.apache.helix.model.Message;
 import org.apache.log4j.Logger;
 
 public class MessageTimeoutTask extends TimerTask {
-	private static Logger LOG = Logger.getLogger(MessageTimeoutTask.class);
-
-	final HelixTaskExecutor _executor;
-	final MessageTask _task;
-
-	public MessageTimeoutTask(HelixTaskExecutor executor, MessageTask task)
-	{
-		_executor = executor;
-		_task = task;
-	}
-
-	@Override
-	public void run() {
-		Message message = _task.getMessage();
-		// NotificationContext context = _task.getNotificationContext();
-		// System.out.println("msg: " + message.getMsgId() + " timeouot.");
-		LOG.warn("Message time out, canceling. id:" + message.getMsgId() + " timeout : "
-		        + message.getExecutionTimeout());
-		_task.onTimeout();
-		_executor.cancelTask(_task);
-	}
-
-}
\ No newline at end of file
+  private static Logger LOG = Logger.getLogger(MessageTimeoutTask.class);
+
+  final HelixTaskExecutor _executor;
+  final MessageTask _task;
+
+  public MessageTimeoutTask(HelixTaskExecutor executor, MessageTask task) {
+    _executor = executor;
+    _task = task;
+  }
+
+  @Override
+  public void run() {
+    Message message = _task.getMessage();
+    // NotificationContext context = _task.getNotificationContext();
+    // System.out.println("msg: " + message.getMsgId() + " timeouot.");
+    LOG.warn("Message time out, canceling. id:" + message.getMsgId() + " timeout : "
+        + message.getExecutionTimeout());
+    _task.onTimeout();
+    _executor.cancelTask(_task);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/messaging/handling/TaskExecutor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/handling/TaskExecutor.java b/helix-core/src/main/java/org/apache/helix/messaging/handling/TaskExecutor.java
index b038e32..b3ff27b 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/handling/TaskExecutor.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/handling/TaskExecutor.java
@@ -24,69 +24,62 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
 public interface TaskExecutor {
-	public static final int DEFAULT_PARALLEL_TASKS = 40;
+  public static final int DEFAULT_PARALLEL_TASKS = 40;
 
-	/**
-	 * register message handler factory this executor can handle
-	 * 
-	 * @param type
-	 * @param factory
-	 */
-	public void registerMessageHandlerFactory(String type, MessageHandlerFactory factory);
+  /**
+   * register message handler factory this executor can handle
+   * @param type
+   * @param factory
+   */
+  public void registerMessageHandlerFactory(String type, MessageHandlerFactory factory);
 
-	/**
-	 * register message handler factory this executor can handle with specified
-	 * thread-pool size
-	 * 
-	 * @param type
-	 * @param factory
-	 * @param threadpoolSize
-	 */
-	public void registerMessageHandlerFactory(String type, MessageHandlerFactory factory,
-	        int threadPoolSize);
+  /**
+   * register message handler factory this executor can handle with specified
+   * thread-pool size
+   * @param type
+   * @param factory
+   * @param threadpoolSize
+   */
+  public void registerMessageHandlerFactory(String type, MessageHandlerFactory factory,
+      int threadPoolSize);
 
-	/**
-	 * schedule a message execution
-	 * 
-	 * @param message
-	 * @param handler
-	 * @param context
-	 */
-	public boolean scheduleTask(MessageTask task);
+  /**
+   * schedule a message execution
+   * @param message
+   * @param handler
+   * @param context
+   */
+  public boolean scheduleTask(MessageTask task);
 
-	/**
-	 * blocking on scheduling all tasks
-	 * 
-	 * @param tasks
-	 */
-	public List<Future<HelixTaskResult>> invokeAllTasks(List<MessageTask> tasks, long timeout, TimeUnit unit)
-	        throws InterruptedException;
+  /**
+   * blocking on scheduling all tasks
+   * @param tasks
+   */
+  public List<Future<HelixTaskResult>> invokeAllTasks(List<MessageTask> tasks, long timeout,
+      TimeUnit unit) throws InterruptedException;
 
-	/**
-	 * cancel a message execution
-	 * 
-	 * @param message
-	 * @param context
-	 */
-	public boolean cancelTask(MessageTask task);
+  /**
+   * cancel a message execution
+   * @param message
+   * @param context
+   */
+  public boolean cancelTask(MessageTask task);
 
-	/**
-	 * cancel the timeout for the given task
-	 * 
-	 * @param task
-	 * @return
-	 */
-	public boolean cancelTimeoutTask(MessageTask task);
-	
-	/**
-	 * finish a message execution
-	 * 
-	 * @param message
-	 */
-	public void finishTask(MessageTask task);
+  /**
+   * cancel the timeout for the given task
+   * @param task
+   * @return
+   */
+  public boolean cancelTimeoutTask(MessageTask task);
 
-	/**
-	 * shutdown executor
-	 */
-	public void shutdown();
-}
\ No newline at end of file
+  /**
+   * finish a message execution
+   * @param message
+   */
+  public void finishTask(MessageTask task);
+
+  /**
+   * shutdown executor
+   */
+  public void shutdown();
+}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/AlertHistory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/AlertHistory.java b/helix-core/src/main/java/org/apache/helix/model/AlertHistory.java
index 170907f..7af017e 100644
--- a/helix-core/src/main/java/org/apache/helix/model/AlertHistory.java
+++ b/helix-core/src/main/java/org/apache/helix/model/AlertHistory.java
@@ -21,18 +21,15 @@ package org.apache.helix.model;
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 
-public class AlertHistory extends HelixProperty
-{
+public class AlertHistory extends HelixProperty {
 
-  public AlertHistory(ZNRecord record)
-  {
+  public AlertHistory(ZNRecord record) {
     super(record);
     // TODO Auto-generated constructor stub
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     // TODO Auto-generated method stub
     return true;
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/AlertStatus.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/AlertStatus.java b/helix-core/src/main/java/org/apache/helix/model/AlertStatus.java
index 1913f2a..d468473 100644
--- a/helix-core/src/main/java/org/apache/helix/model/AlertStatus.java
+++ b/helix-core/src/main/java/org/apache/helix/model/AlertStatus.java
@@ -24,24 +24,20 @@ import java.util.Map;
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 
-
-public class AlertStatus extends HelixProperty
-{
+public class AlertStatus extends HelixProperty {
 
   public final static String nodeName = "AlertStatus";
 
-  public enum AlertsProperty
-  {
-    SESSION_ID, FIELDS
+  public enum AlertsProperty {
+    SESSION_ID,
+    FIELDS
   }
 
-  public AlertStatus(String id)
-  {
+  public AlertStatus(String id) {
     super(id);
   }
 
-  public AlertStatus(ZNRecord record)
-  {
+  public AlertStatus(ZNRecord record) {
     // _record = record;
     super(record);
 
@@ -51,18 +47,15 @@ public class AlertStatus extends HelixProperty
    * public Alerts(ZNRecord record, Stat stat) { super(record, stat); }
    */
 
-  public void setSessionId(String sessionId)
-  {
+  public void setSessionId(String sessionId) {
     _record.setSimpleField(AlertsProperty.SESSION_ID.toString(), sessionId);
   }
 
-  public String getSessionId()
-  {
+  public String getSessionId() {
     return _record.getSimpleField(AlertsProperty.SESSION_ID.toString());
   }
 
-  public String getInstanceName()
-  {
+  public String getInstanceName() {
     return _record.getId();
   }
 
@@ -71,19 +64,16 @@ public class AlertStatus extends HelixProperty
    * _record.getSimpleField(AlertsProperty.CLUSTER_MANAGER_VERSION.toString()); }
    */
 
-  public Map<String, Map<String, String>> getMapFields()
-  {
+  public Map<String, Map<String, String>> getMapFields() {
     return _record.getMapFields();
   }
 
-  public Map<String, String> getStatFields(String statName)
-  {
+  public Map<String, String> getStatFields(String statName) {
     return _record.getMapField(statName);
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     // TODO Auto-generated method stub
     return true;
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/Alerts.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/Alerts.java b/helix-core/src/main/java/org/apache/helix/model/Alerts.java
index f0318f8..02db44c 100644
--- a/helix-core/src/main/java/org/apache/helix/model/Alerts.java
+++ b/helix-core/src/main/java/org/apache/helix/model/Alerts.java
@@ -24,28 +24,24 @@ import java.util.Map;
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 
-
-public class Alerts extends HelixProperty
-{
+public class Alerts extends HelixProperty {
 
   // private final ZNRecord _record;
 
   public final static String nodeName = "Alerts";
 
-  public enum AlertsProperty
-  {
-    SESSION_ID, FIELDS
+  public enum AlertsProperty {
+    SESSION_ID,
+    FIELDS
   }
 
   // private final ZNRecord _record;
 
-  public Alerts(String id)
-  {
+  public Alerts(String id) {
     super(id);
   }
 
-  public Alerts(ZNRecord record)
-  {
+  public Alerts(ZNRecord record) {
     // _record = record;
     super(record);
 
@@ -55,18 +51,15 @@ public class Alerts extends HelixProperty
    * public Alerts(ZNRecord record, Stat stat) { super(record, stat); }
    */
 
-  public void setSessionId(String sessionId)
-  {
+  public void setSessionId(String sessionId) {
     _record.setSimpleField(AlertsProperty.SESSION_ID.toString(), sessionId);
   }
 
-  public String getSessionId()
-  {
+  public String getSessionId() {
     return _record.getSimpleField(AlertsProperty.SESSION_ID.toString());
   }
 
-  public String getInstanceName()
-  {
+  public String getInstanceName() {
     return _record.getId();
   }
 
@@ -76,19 +69,16 @@ public class Alerts extends HelixProperty
    * }
    */
 
-  public Map<String, Map<String, String>> getMapFields()
-  {
+  public Map<String, Map<String, String>> getMapFields() {
     return _record.getMapFields();
   }
 
-  public Map<String, String> getStatFields(String statName)
-  {
+  public Map<String, String> getStatFields(String statName) {
     return _record.getMapField(statName);
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     // TODO Auto-generated method stub
     return true;
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/ClusterConstraints.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/ClusterConstraints.java b/helix-core/src/main/java/org/apache/helix/model/ClusterConstraints.java
index 30ff526..15c4345 100644
--- a/helix-core/src/main/java/org/apache/helix/model/ClusterConstraints.java
+++ b/helix-core/src/main/java/org/apache/helix/model/ClusterConstraints.java
@@ -31,56 +31,53 @@ import org.apache.helix.model.Message.MessageType;
 import org.apache.helix.model.builder.ConstraintItemBuilder;
 import org.apache.log4j.Logger;
 
-
-public class ClusterConstraints extends HelixProperty
-{
+public class ClusterConstraints extends HelixProperty {
   private static Logger LOG = Logger.getLogger(ClusterConstraints.class);
 
-  public enum ConstraintAttribute
-  {
-    STATE, MESSAGE_TYPE, TRANSITION, RESOURCE, INSTANCE, CONSTRAINT_VALUE
+  public enum ConstraintAttribute {
+    STATE,
+    MESSAGE_TYPE,
+    TRANSITION,
+    RESOURCE,
+    INSTANCE,
+    CONSTRAINT_VALUE
   }
 
-  public enum ConstraintValue
-  {
+  public enum ConstraintValue {
     ANY
   }
 
-  public enum ConstraintType
-  {
-    STATE_CONSTRAINT, MESSAGE_CONSTRAINT
+  public enum ConstraintType {
+    STATE_CONSTRAINT,
+    MESSAGE_CONSTRAINT
   }
 
   // constraint-id -> constraint-item
   private final Map<String, ConstraintItem> _constraints = new HashMap<String, ConstraintItem>();
-  
+
   public ClusterConstraints(ConstraintType type) {
     super(type.toString());
   }
-  
-  public ClusterConstraints(ZNRecord record)
-  {
+
+  public ClusterConstraints(ZNRecord record) {
     super(record);
 
-    for (String constraintId : _record.getMapFields().keySet())
-    {
+    for (String constraintId : _record.getMapFields().keySet()) {
       ConstraintItemBuilder builder = new ConstraintItemBuilder();
-      ConstraintItem item =  builder.addConstraintAttributes(_record.getMapField(constraintId)).build();
+      ConstraintItem item =
+          builder.addConstraintAttributes(_record.getMapField(constraintId)).build();
       // ignore item with empty attributes or no constraint-value
-      if (item.getAttributes().size() > 0 && item.getConstraintValue() != null)
-      {
+      if (item.getAttributes().size() > 0 && item.getConstraintValue() != null) {
         addConstraintItem(constraintId, item);
-      } else
-      {
-        LOG.error("Skip invalid constraint. key: " + constraintId + ", value: " 
-              + _record.getMapField(constraintId));
+      } else {
+        LOG.error("Skip invalid constraint. key: " + constraintId + ", value: "
+            + _record.getMapField(constraintId));
       }
     }
   }
 
   /**
    * add the constraint, overwrite existing one if constraint with same constraint-id already exists
-   * 
    * @param constraintId
    * @param item
    */
@@ -93,43 +90,38 @@ public class ClusterConstraints extends HelixProperty
     _record.setMapField(constraintId, map);
     _constraints.put(constraintId, item);
   }
-  
+
   public void addConstraintItems(Map<String, ConstraintItem> items) {
     for (String constraintId : items.keySet()) {
       addConstraintItem(constraintId, items.get(constraintId));
     }
   }
-  
+
   /**
    * remove a constraint-item
-   * 
    * @param constraintId
    */
   public void removeConstraintItem(String constraintId) {
     _constraints.remove(constraintId);
     _record.getMapFields().remove(constraintId);
   }
-  
+
   /**
    * get a constraint-item
-   * 
    * @param constraintId
    * @return
    */
   public ConstraintItem getConstraintItem(String constraintId) {
     return _constraints.get(constraintId);
   }
-  
+
   /**
    * return a set of constraints that match the attribute pairs
    */
-  public Set<ConstraintItem> match(Map<ConstraintAttribute, String> attributes)
-  {
+  public Set<ConstraintItem> match(Map<ConstraintAttribute, String> attributes) {
     Set<ConstraintItem> matches = new HashSet<ConstraintItem>();
-    for (ConstraintItem item : _constraints.values())
-    {
-      if (item.match(attributes))
-      {
+    for (ConstraintItem item : _constraints.values()) {
+      if (item.match(attributes)) {
         matches.add(item);
       }
     }
@@ -137,24 +129,18 @@ public class ClusterConstraints extends HelixProperty
   }
 
   // convert a message to constraint attribute pairs
-  public static Map<ConstraintAttribute, String> toConstraintAttributes(Message msg)
-  {
+  public static Map<ConstraintAttribute, String> toConstraintAttributes(Message msg) {
     Map<ConstraintAttribute, String> attributes = new TreeMap<ConstraintAttribute, String>();
     String msgType = msg.getMsgType();
     attributes.put(ConstraintAttribute.MESSAGE_TYPE, msgType);
-    if (MessageType.STATE_TRANSITION.toString().equals(msgType))
-    {
-      if (msg.getFromState() != null && msg.getToState() != null)
-      {
-        attributes.put(ConstraintAttribute.TRANSITION,
-            msg.getFromState() + "-" + msg.getToState());
+    if (MessageType.STATE_TRANSITION.toString().equals(msgType)) {
+      if (msg.getFromState() != null && msg.getToState() != null) {
+        attributes.put(ConstraintAttribute.TRANSITION, msg.getFromState() + "-" + msg.getToState());
       }
-      if (msg.getResourceName() != null)
-      {
+      if (msg.getResourceName() != null) {
         attributes.put(ConstraintAttribute.RESOURCE, msg.getResourceName());
       }
-      if (msg.getTgtName() != null)
-      {
+      if (msg.getTgtName() != null) {
         attributes.put(ConstraintAttribute.INSTANCE, msg.getTgtName());
       }
     }
@@ -162,8 +148,7 @@ public class ClusterConstraints extends HelixProperty
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     // TODO Auto-generated method stub
     return true;
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/ConfigScope.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/ConfigScope.java b/helix-core/src/main/java/org/apache/helix/model/ConfigScope.java
index 6985703..292ef0f 100644
--- a/helix-core/src/main/java/org/apache/helix/model/ConfigScope.java
+++ b/helix-core/src/main/java/org/apache/helix/model/ConfigScope.java
@@ -30,11 +30,10 @@ import org.apache.helix.util.StringTemplate;
 import org.apache.log4j.Logger;
 
 /**
- *  @deprecated replaced by {@link HelixConfigScope}
+ * @deprecated replaced by {@link HelixConfigScope}
  */
 @Deprecated
-public class ConfigScope
-{
+public class ConfigScope {
   private static Logger LOG = Logger.getLogger(ConfigScope.class);
 
   private static final List<ConfigScopeProperty> scopePriority =
@@ -42,8 +41,7 @@ public class ConfigScope
   private static final Map<ConfigScopeProperty, Map<ConfigScopeProperty, ConfigScopeProperty>> scopeTransition =
       new HashMap<ConfigScopeProperty, Map<ConfigScopeProperty, ConfigScopeProperty>>();
   private static final StringTemplate template = new StringTemplate();
-  static
-  {
+  static {
     // scope priority: CLUSTER > PARTICIPANT > RESOURCE > PARTITION
     scopePriority.add(ConfigScopeProperty.CLUSTER);
     scopePriority.add(ConfigScopeProperty.PARTICIPANT);
@@ -52,64 +50,54 @@ public class ConfigScope
 
     // scope transition table to check valid inputs
     scopeTransition.put(ConfigScopeProperty.CLUSTER,
-                        new HashMap<ConfigScopeProperty, ConfigScopeProperty>());
+        new HashMap<ConfigScopeProperty, ConfigScopeProperty>());
     scopeTransition.get(ConfigScopeProperty.CLUSTER).put(ConfigScopeProperty.PARTICIPANT,
-                                                         ConfigScopeProperty.PARTICIPANT);
+        ConfigScopeProperty.PARTICIPANT);
     scopeTransition.get(ConfigScopeProperty.CLUSTER).put(ConfigScopeProperty.RESOURCE,
-                                                         ConfigScopeProperty.RESOURCE);
+        ConfigScopeProperty.RESOURCE);
     scopeTransition.put(ConfigScopeProperty.RESOURCE,
-                        new HashMap<ConfigScopeProperty, ConfigScopeProperty>());
+        new HashMap<ConfigScopeProperty, ConfigScopeProperty>());
     scopeTransition.get(ConfigScopeProperty.RESOURCE).put(ConfigScopeProperty.PARTITION,
-                                                          ConfigScopeProperty.PARTITION);
+        ConfigScopeProperty.PARTITION);
 
     // string templates to generate znode path/index
     // @formatter:off
-    template.addEntry(ConfigScopeProperty.CLUSTER,
-                      2,
-                      "/{clusterName}/CONFIGS/CLUSTER/{clusterName}");
-    template.addEntry(ConfigScopeProperty.PARTICIPANT,
-                      2,
-                      "/{clusterName}/CONFIGS/PARTICIPANT/{participantName}");
-    template.addEntry(ConfigScopeProperty.RESOURCE,
-                      2,
-                      "/{clusterName}/CONFIGS/RESOURCE/{resourceName}");
-    template.addEntry(ConfigScopeProperty.PARTITION,
-                      3,
-                      "/{clusterName}/CONFIGS/RESOURCE/{resourceName}|{partitionName}");
+    template.addEntry(ConfigScopeProperty.CLUSTER, 2,
+        "/{clusterName}/CONFIGS/CLUSTER/{clusterName}");
+    template.addEntry(ConfigScopeProperty.PARTICIPANT, 2,
+        "/{clusterName}/CONFIGS/PARTICIPANT/{participantName}");
+    template.addEntry(ConfigScopeProperty.RESOURCE, 2,
+        "/{clusterName}/CONFIGS/RESOURCE/{resourceName}");
+    template.addEntry(ConfigScopeProperty.PARTITION, 3,
+        "/{clusterName}/CONFIGS/RESOURCE/{resourceName}|{partitionName}");
     // @formatter:on
   }
 
   private final String _clusterName;
   private final ConfigScopeProperty _scope;
 
-    /**
-     * _scopeStr is like:
-     *   "/ClusterName/CONFIGS/{CLUSTER|PARTICIPANT|RESOURCE|PARTITION}/{clusterName|instanceName|resourceName}{|partitionName}"
-     */
+  /**
+   * _scopeStr is like:
+   * "/ClusterName/CONFIGS/{CLUSTER|PARTICIPANT|RESOURCE|PARTITION}/{clusterName|instanceName|resourceName}{|partitionName}"
+   */
   private final String _scopeStr;
 
-  public ConfigScope(ConfigScopeBuilder configScopeBuilder)
-  {
-    Map<ConfigScopeProperty, String> scopeMap = configScopeBuilder
-        .getScopeMap();
+  public ConfigScope(ConfigScopeBuilder configScopeBuilder) {
+    Map<ConfigScopeProperty, String> scopeMap = configScopeBuilder.getScopeMap();
     List<String> keys = new ArrayList<String>();
 
     ConfigScopeProperty curScope = null;
-    for (ConfigScopeProperty scope : scopePriority)
-    {
-      if (scopeMap.containsKey(scope))
-      {
-        if (curScope == null && scope == ConfigScopeProperty.CLUSTER)
-        {
+    for (ConfigScopeProperty scope : scopePriority) {
+      if (scopeMap.containsKey(scope)) {
+        if (curScope == null && scope == ConfigScopeProperty.CLUSTER) {
           keys.add(scopeMap.get(scope));
           curScope = ConfigScopeProperty.CLUSTER;
-        } else if (curScope == null)
-        {
-          throw new IllegalArgumentException("Missing CLUSTER scope. Can't build scope using " + configScopeBuilder);
-        } else
-        {
-          if (!scopeTransition.containsKey(curScope) || !scopeTransition.get(curScope).containsKey(scope))
-          {
+        } else if (curScope == null) {
+          throw new IllegalArgumentException("Missing CLUSTER scope. Can't build scope using "
+              + configScopeBuilder);
+        } else {
+          if (!scopeTransition.containsKey(curScope)
+              || !scopeTransition.get(curScope).containsKey(scope)) {
             throw new IllegalArgumentException("Can't build scope using " + configScopeBuilder);
           }
           keys.add(scopeMap.get(scope));
@@ -118,8 +106,7 @@ public class ConfigScope
       }
     }
 
-    if (curScope == ConfigScopeProperty.CLUSTER)
-    {
+    if (curScope == ConfigScopeProperty.CLUSTER) {
       // append one more {clusterName}
       keys.add(scopeMap.get(ConfigScopeProperty.CLUSTER));
     }
@@ -131,24 +118,20 @@ public class ConfigScope
     _scope = curScope;
   }
 
-  public ConfigScopeProperty getScope()
-  {
+  public ConfigScopeProperty getScope() {
     return _scope;
   }
 
-  public String getClusterName()
-  {
+  public String getClusterName() {
     return _clusterName;
   }
 
-  public String getScopeStr()
-  {
+  public String getScopeStr() {
     return _scopeStr;
   }
 
   @Override
-  public String toString()
-  {
+  public String toString() {
     return super.toString() + ": " + _scopeStr;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/ConstraintItem.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/ConstraintItem.java b/helix-core/src/main/java/org/apache/helix/model/ConstraintItem.java
index ad2f763..be032af 100644
--- a/helix-core/src/main/java/org/apache/helix/model/ConstraintItem.java
+++ b/helix-core/src/main/java/org/apache/helix/model/ConstraintItem.java
@@ -39,24 +39,19 @@ public class ConstraintItem {
     _attributes = builder.getAttributes();
     _constraintValue = builder.getConstraintValue();
   }
-  
-  public ConstraintItem(Map<ConstraintAttribute, String> attributes, String constraintValue)
-  {
+
+  public ConstraintItem(Map<ConstraintAttribute, String> attributes, String constraintValue) {
     _attributes = attributes;
     _constraintValue = constraintValue;
   }
 
-  public boolean match(Map<ConstraintAttribute, String> attributes)
-  {
-    for (ConstraintAttribute key : _attributes.keySet())
-    {
-      if (!attributes.containsKey(key))
-      {
+  public boolean match(Map<ConstraintAttribute, String> attributes) {
+    for (ConstraintAttribute key : _attributes.keySet()) {
+      if (!attributes.containsKey(key)) {
         return false;
       }
 
-      if (!attributes.get(key).matches(_attributes.get(key)))
-      {
+      if (!attributes.get(key).matches(_attributes.get(key))) {
         return false;
       }
     }
@@ -64,35 +59,30 @@ public class ConstraintItem {
   }
 
   // filter out attributes that are not specified by this constraint
-  public Map<ConstraintAttribute, String> filter(Map<ConstraintAttribute, String> attributes)
-  {
+  public Map<ConstraintAttribute, String> filter(Map<ConstraintAttribute, String> attributes) {
     Map<ConstraintAttribute, String> ret = new HashMap<ConstraintAttribute, String>();
-    for (ConstraintAttribute key : _attributes.keySet())
-    {
-      // TODO: what if attributes.get(key)==null? might need match function at constrait level  
+    for (ConstraintAttribute key : _attributes.keySet()) {
+      // TODO: what if attributes.get(key)==null? might need match function at constrait level
       ret.put(key, attributes.get(key));
     }
 
     return ret;
   }
 
-  public String getConstraintValue()
-  {
+  public String getConstraintValue() {
     return _constraintValue;
   }
 
-  public Map<ConstraintAttribute, String> getAttributes()
-  {
+  public Map<ConstraintAttribute, String> getAttributes() {
     return _attributes;
   }
-  
+
   public String getAttributeValue(ConstraintAttribute attr) {
     return _attributes.get(attr);
   }
 
   @Override
-  public String toString()
-  {
+  public String toString() {
     StringBuffer sb = new StringBuffer();
     sb.append(_attributes + ":" + _constraintValue);
     return sb.toString();

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/CurrentState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/CurrentState.java b/helix-core/src/main/java/org/apache/helix/model/CurrentState.java
index 881311b..901ee10 100644
--- a/helix-core/src/main/java/org/apache/helix/model/CurrentState.java
+++ b/helix-core/src/main/java/org/apache/helix/model/CurrentState.java
@@ -27,143 +27,122 @@ import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 import org.apache.log4j.Logger;
 
-
 /**
  * Current states of partitions in a resource
  */
-public class CurrentState extends HelixProperty
-{
+public class CurrentState extends HelixProperty {
   private static Logger LOG = Logger.getLogger(CurrentState.class);
 
-  public enum CurrentStateProperty
-  {
-    SESSION_ID, CURRENT_STATE, STATE_MODEL_DEF, STATE_MODEL_FACTORY_NAME, RESOURCE // ,
-                                                                                   // BUCKET_SIZE
+  public enum CurrentStateProperty {
+    SESSION_ID,
+    CURRENT_STATE,
+    STATE_MODEL_DEF,
+    STATE_MODEL_FACTORY_NAME,
+    RESOURCE // ,
+             // BUCKET_SIZE
   }
 
-  public CurrentState(String resourceName)
-  {
+  public CurrentState(String resourceName) {
     super(resourceName);
   }
 
-  public CurrentState(ZNRecord record)
-  {
+  public CurrentState(ZNRecord record) {
     super(record);
   }
 
-  public String getResourceName()
-  {
+  public String getResourceName() {
     return _record.getId();
   }
 
-  public Map<String, String> getPartitionStateMap()
-  {
+  public Map<String, String> getPartitionStateMap() {
     Map<String, String> map = new HashMap<String, String>();
     Map<String, Map<String, String>> mapFields = _record.getMapFields();
-    for (String partitionName : mapFields.keySet())
-    {
+    for (String partitionName : mapFields.keySet()) {
       Map<String, String> tempMap = mapFields.get(partitionName);
-      if (tempMap != null)
-      {
+      if (tempMap != null) {
         map.put(partitionName, tempMap.get(CurrentStateProperty.CURRENT_STATE.toString()));
       }
     }
     return map;
   }
 
-  public String getSessionId()
-  {
+  public String getSessionId() {
     return _record.getSimpleField(CurrentStateProperty.SESSION_ID.toString());
   }
 
-  public void setSessionId(String sessionId)
-  {
+  public void setSessionId(String sessionId) {
     _record.setSimpleField(CurrentStateProperty.SESSION_ID.toString(), sessionId);
   }
 
-  public String getState(String partitionName)
-  {
+  public String getState(String partitionName) {
     Map<String, Map<String, String>> mapFields = _record.getMapFields();
     Map<String, String> mapField = mapFields.get(partitionName);
-    if (mapField != null)
-    {
+    if (mapField != null) {
       return mapField.get(CurrentStateProperty.CURRENT_STATE.toString());
     }
     return null;
   }
 
-  public void setStateModelDefRef(String stateModelName)
-  {
-    _record.setSimpleField(CurrentStateProperty.STATE_MODEL_DEF.toString(),
-                           stateModelName);
+  public void setStateModelDefRef(String stateModelName) {
+    _record.setSimpleField(CurrentStateProperty.STATE_MODEL_DEF.toString(), stateModelName);
   }
 
-  public String getStateModelDefRef()
-  {
+  public String getStateModelDefRef() {
     return _record.getSimpleField(CurrentStateProperty.STATE_MODEL_DEF.toString());
   }
 
-  public void setState(String partitionName, String state)
-  {
+  public void setState(String partitionName, String state) {
     Map<String, Map<String, String>> mapFields = _record.getMapFields();
-    if (mapFields.get(partitionName) == null)
-    {
+    if (mapFields.get(partitionName) == null) {
       mapFields.put(partitionName, new TreeMap<String, String>());
     }
-    mapFields.get(partitionName)
-             .put(CurrentStateProperty.CURRENT_STATE.toString(), state);
+    mapFields.get(partitionName).put(CurrentStateProperty.CURRENT_STATE.toString(), state);
   }
 
-  public void setStateModelFactoryName(String factoryName)
-  {
-    _record.setSimpleField(CurrentStateProperty.STATE_MODEL_FACTORY_NAME.toString(),
-                           factoryName);
+  public void setStateModelFactoryName(String factoryName) {
+    _record.setSimpleField(CurrentStateProperty.STATE_MODEL_FACTORY_NAME.toString(), factoryName);
   }
 
-  public String getStateModelFactoryName()
-  {
+  public String getStateModelFactoryName() {
     return _record.getSimpleField(CurrentStateProperty.STATE_MODEL_FACTORY_NAME.toString());
   }
 
-//  @Override
-//  public int getBucketSize()
-//  {
-//    String bucketSizeStr =
-//        _record.getSimpleField(CurrentStateProperty.BUCKET_SIZE.toString());
-//    int bucketSize = 0;
-//    if (bucketSizeStr != null)
-//    {
-//      try
-//      {
-//        bucketSize = Integer.parseInt(bucketSizeStr);
-//      }
-//      catch (NumberFormatException e)
-//      {
-//        // OK
-//      }
-//    }
-//    return bucketSize;
-//  }
-//
-//  @Override
-//  public void setBucketSize(int bucketSize)
-//  {
-//    if (bucketSize > 0)
-//    {
-//      _record.setSimpleField(CurrentStateProperty.BUCKET_SIZE.toString(), "" + bucketSize);
-//    }
-//  }
+  // @Override
+  // public int getBucketSize()
+  // {
+  // String bucketSizeStr =
+  // _record.getSimpleField(CurrentStateProperty.BUCKET_SIZE.toString());
+  // int bucketSize = 0;
+  // if (bucketSizeStr != null)
+  // {
+  // try
+  // {
+  // bucketSize = Integer.parseInt(bucketSizeStr);
+  // }
+  // catch (NumberFormatException e)
+  // {
+  // // OK
+  // }
+  // }
+  // return bucketSize;
+  // }
+  //
+  // @Override
+  // public void setBucketSize(int bucketSize)
+  // {
+  // if (bucketSize > 0)
+  // {
+  // _record.setSimpleField(CurrentStateProperty.BUCKET_SIZE.toString(), "" + bucketSize);
+  // }
+  // }
 
   @Override
-  public boolean isValid()
-  {
-    if (getStateModelDefRef() == null)
-    {
+  public boolean isValid() {
+    if (getStateModelDefRef() == null) {
       LOG.error("Current state does not contain state model ref. id:" + getResourceName());
       return false;
     }
-    if (getSessionId() == null)
-    {
+    if (getSessionId() == null) {
       LOG.error("CurrentState does not contain session id, id : " + getResourceName());
       return false;
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/Error.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/Error.java b/helix-core/src/main/java/org/apache/helix/model/Error.java
index 2d5e75c..b9b6ddf 100644
--- a/helix-core/src/main/java/org/apache/helix/model/Error.java
+++ b/helix-core/src/main/java/org/apache/helix/model/Error.java
@@ -22,17 +22,14 @@ package org.apache.helix.model;
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 
-public class Error extends HelixProperty
-{
-  public Error(ZNRecord record)
-  {
+public class Error extends HelixProperty {
+  public Error(ZNRecord record) {
     super(record);
     // TODO Auto-generated constructor stub
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     // TODO Auto-generated method stub
     return true;
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/ExternalView.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/ExternalView.java b/helix-core/src/main/java/org/apache/helix/model/ExternalView.java
index 34aaf7d..fd5c79a 100644
--- a/helix-core/src/main/java/org/apache/helix/model/ExternalView.java
+++ b/helix-core/src/main/java/org/apache/helix/model/ExternalView.java
@@ -26,56 +26,44 @@ import java.util.TreeMap;
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 
-
 /**
  * External view is an aggregation (across all instances)
- *  of current states for the partitions in a resource
+ * of current states for the partitions in a resource
  */
-public class ExternalView extends HelixProperty
-{
-  public ExternalView(String resource)
-  {
+public class ExternalView extends HelixProperty {
+  public ExternalView(String resource) {
     super(new ZNRecord(resource));
   }
 
-  public ExternalView(ZNRecord record)
-  {
+  public ExternalView(ZNRecord record) {
     super(record);
   }
 
-  public void setState(String partition, String instance, String state)
-  {
-    if(_record.getMapField(partition) == null)
-    {
+  public void setState(String partition, String instance, String state) {
+    if (_record.getMapField(partition) == null) {
       _record.setMapField(partition, new TreeMap<String, String>());
     }
     _record.getMapField(partition).put(instance, state);
   }
 
-  public void setStateMap(String partitionName,
-      Map<String, String> currentStateMap)
-  {
+  public void setStateMap(String partitionName, Map<String, String> currentStateMap) {
     _record.setMapField(partitionName, currentStateMap);
   }
 
-  public Set<String> getPartitionSet()
-  {
+  public Set<String> getPartitionSet() {
     return _record.getMapFields().keySet();
   }
 
-  public Map<String, String> getStateMap(String partitionName)
-  {
+  public Map<String, String> getStateMap(String partitionName) {
     return _record.getMapField(partitionName);
   }
 
-  public String getResourceName()
-  {
+  public String getResourceName() {
     return _record.getId();
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     return true;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/HealthStat.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/HealthStat.java b/helix-core/src/main/java/org/apache/helix/model/HealthStat.java
index a8a0ef0..42ac339 100644
--- a/helix-core/src/main/java/org/apache/helix/model/HealthStat.java
+++ b/helix-core/src/main/java/org/apache/helix/model/HealthStat.java
@@ -30,52 +30,43 @@ import org.apache.helix.alerts.StatsHolder;
 import org.apache.helix.model.Message.Attributes;
 import org.apache.log4j.Logger;
 
-
-public class HealthStat extends HelixProperty 
-{
-  public enum HealthStatProperty
-  {
+public class HealthStat extends HelixProperty {
+  public enum HealthStatProperty {
     FIELDS
   }
+
   private static final Logger _logger = Logger.getLogger(HealthStat.class.getName());
 
-  public HealthStat(String id)
-  {
+  public HealthStat(String id) {
     super(id);
   }
 
-  public HealthStat(ZNRecord record)
-    {
-      super(record);
-      if(getCreateTimeStamp() == 0)
-      {
-        _record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), new Date().getTime());
-      }
+  public HealthStat(ZNRecord record) {
+    super(record);
+    if (getCreateTimeStamp() == 0) {
+      _record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), new Date().getTime());
     }
+  }
 
-  public long getLastModifiedTimeStamp()
-  {
+  public long getLastModifiedTimeStamp() {
     return _record.getModifiedTime();
   }
 
-  public long getCreateTimeStamp()
-  {
+  public long getCreateTimeStamp() {
     return _record.getLongField(Attributes.CREATE_TIMESTAMP.toString(), 0L);
   }
-  
-  public String getTestField()
-  {
+
+  public String getTestField() {
     return _record.getSimpleField("requestCountStat");
   }
-  
-  public void setHealthFields(Map<String, Map<String, String>> healthFields)
-  {
+
+  public void setHealthFields(Map<String, Map<String, String>> healthFields) {
     _record.setMapFields(healthFields);
   }
-  
-  public String buildCompositeKey(String instance, String parentKey, String statName ) {
+
+  public String buildCompositeKey(String instance, String parentKey, String statName) {
     String delim = ExpressionParser.statFieldDelim;
-    return instance+delim+parentKey+delim+statName;
+    return instance + delim + parentKey + delim + statName;
   }
 
   public Map<String, Map<String, String>> getHealthFields(String instanceName) // ,
@@ -85,15 +76,13 @@ public class HealthStat extends HelixProperty
     // XXX: need to do some conversion of input format to the format that stats
     // computation wants
     Map<String, Map<String, String>> currMapFields = _record.getMapFields();
-    Map<String, Map<String, String>> convertedMapFields = new HashMap<String, Map<String, String>>();
-    for (String key : currMapFields.keySet())
-    {
+    Map<String, Map<String, String>> convertedMapFields =
+        new HashMap<String, Map<String, String>>();
+    for (String key : currMapFields.keySet()) {
       Map<String, String> currMap = currMapFields.get(key);
       String timestamp = _record.getStringField(StatsHolder.TIMESTAMP_NAME, "-1");
-      for (String subKey : currMap.keySet())
-      {
-        if (subKey.equals("StatsHolder.TIMESTAMP_NAME"))
-        { // don't want to get timestamp again
+      for (String subKey : currMap.keySet()) {
+        if (subKey.equals("StatsHolder.TIMESTAMP_NAME")) { // don't want to get timestamp again
           continue;
         }
         String compositeKey = buildCompositeKey(instanceName, key, subKey);
@@ -103,10 +92,10 @@ public class HealthStat extends HelixProperty
         convertedMap.put(StatsHolder.TIMESTAMP_NAME, timestamp);
         convertedMapFields.put(compositeKey, convertedMap);
       }
-    } 
+    }
     return convertedMapFields;
   }
-  
+
   @Override
   public boolean isValid() {
     // TODO Auto-generated method stub

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/HelixConfigScope.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/HelixConfigScope.java b/helix-core/src/main/java/org/apache/helix/model/HelixConfigScope.java
index 614e768..a8034de 100644
--- a/helix-core/src/main/java/org/apache/helix/model/HelixConfigScope.java
+++ b/helix-core/src/main/java/org/apache/helix/model/HelixConfigScope.java
@@ -25,89 +25,75 @@ import org.apache.helix.util.StringTemplate;
 
 /**
  * config-scope that replaces @link ConfigScope
- *
  */
 public class HelixConfigScope {
-  
-  public enum ConfigScopeProperty
-  {
-    CLUSTER(2, 0), 
-    PARTICIPANT(2, 0), 
-    RESOURCE(2, 0), 
-    PARTITION(2, 1), 
+
+  public enum ConfigScopeProperty {
+    CLUSTER(2, 0),
+    PARTICIPANT(2, 0),
+    RESOURCE(2, 0),
+    PARTITION(2, 1),
     CONSTRAINT(2, 0);
-    
+
     final int _zkPathArgNum;
     final int _mapKeyArgNum;
-    
+
     private ConfigScopeProperty(int zkPathArgNum, int mapKeyArgNum) {
-     _zkPathArgNum = zkPathArgNum;
-     _mapKeyArgNum = mapKeyArgNum;
+      _zkPathArgNum = zkPathArgNum;
+      _mapKeyArgNum = mapKeyArgNum;
     }
-    
+
     public int getZkPathArgNum() {
       return _zkPathArgNum;
     }
-    
+
     public int getMapKeyArgNum() {
       return _mapKeyArgNum;
-    }    
+    }
   }
-  
+
   // string templates to generate znode path
   private static final StringTemplate template = new StringTemplate();
   static {
     // get the znode
-    template.addEntry(ConfigScopeProperty.CLUSTER,
-                      2,
-                      "/{clusterName}/CONFIGS/CLUSTER/{clusterName}");
-
-    template.addEntry(ConfigScopeProperty.PARTICIPANT,
-                      2,
-                      "/{clusterName}/CONFIGS/PARTICIPANT/{participantName}");
-    template.addEntry(ConfigScopeProperty.RESOURCE,
-                      2,
-                      "/{clusterName}/CONFIGS/RESOURCE/{resourceName}");
-    template.addEntry(ConfigScopeProperty.PARTITION,
-                      2,
-                      "/{clusterName}/CONFIGS/RESOURCE/{resourceName}");
-    
+    template.addEntry(ConfigScopeProperty.CLUSTER, 2,
+        "/{clusterName}/CONFIGS/CLUSTER/{clusterName}");
+
+    template.addEntry(ConfigScopeProperty.PARTICIPANT, 2,
+        "/{clusterName}/CONFIGS/PARTICIPANT/{participantName}");
+    template.addEntry(ConfigScopeProperty.RESOURCE, 2,
+        "/{clusterName}/CONFIGS/RESOURCE/{resourceName}");
+    template.addEntry(ConfigScopeProperty.PARTITION, 2,
+        "/{clusterName}/CONFIGS/RESOURCE/{resourceName}");
+
     // get children
-    template.addEntry(ConfigScopeProperty.CLUSTER,
-                      1,
-                      "/{clusterName}/CONFIGS/CLUSTER");
-    template.addEntry(ConfigScopeProperty.PARTICIPANT,
-                      1,
-                      "/{clusterName}/CONFIGS/PARTICIPANT");
-    template.addEntry(ConfigScopeProperty.RESOURCE,
-                      1,
-                      "/{clusterName}/CONFIGS/RESOURCE");
+    template.addEntry(ConfigScopeProperty.CLUSTER, 1, "/{clusterName}/CONFIGS/CLUSTER");
+    template.addEntry(ConfigScopeProperty.PARTICIPANT, 1, "/{clusterName}/CONFIGS/PARTICIPANT");
+    template.addEntry(ConfigScopeProperty.RESOURCE, 1, "/{clusterName}/CONFIGS/RESOURCE");
   }
-  
+
   final ConfigScopeProperty _type;
   final String _clusterName;
-  
+
   /**
    * this is participantName if type is PARTICIPANT or null otherwise
    */
   final String _participantName;
-  
+
   final String _zkPath;
   final String _mapKey;
-  
+
   /**
    * use full-key to get config, use non-full-key to get config-keys
    */
   final boolean _isFullKey;
-  
-  public HelixConfigScope(ConfigScopeProperty type, 
-                          List<String> zkPathKeys, 
-                          String mapKey) {
-    
+
+  public HelixConfigScope(ConfigScopeProperty type, List<String> zkPathKeys, String mapKey) {
+
     if (zkPathKeys.size() != type.getZkPathArgNum()
-        && zkPathKeys.size() != (type.getZkPathArgNum() - 1) ) {
-      throw new IllegalArgumentException(type + " requires " + type.getZkPathArgNum() 
-          + " arguments to get znode or " + (type.getZkPathArgNum() - 1) 
+        && zkPathKeys.size() != (type.getZkPathArgNum() - 1)) {
+      throw new IllegalArgumentException(type + " requires " + type.getZkPathArgNum()
+          + " arguments to get znode or " + (type.getZkPathArgNum() - 1)
           + " arguments to get children, but was: " + zkPathKeys);
     }
 
@@ -116,33 +102,33 @@ public class HelixConfigScope {
     } else {
       _isFullKey = (zkPathKeys.size() == type.getZkPathArgNum());
     }
-    
+
     _type = type;
     _clusterName = zkPathKeys.get(0);
-    
+
     // init participantName
     if (type == ConfigScopeProperty.PARTICIPANT && _isFullKey) {
       _participantName = zkPathKeys.get(1);
     } else {
       _participantName = null;
     }
-    
+
     _zkPath = template.instantiate(type, zkPathKeys.toArray(new String[0]));
     _mapKey = mapKey;
   }
-  
+
   public ConfigScopeProperty getType() {
     return _type;
   }
-  
+
   public String getClusterName() {
     return _clusterName;
   }
-  
+
   public String getParticipantName() {
     return _participantName;
   }
-  
+
   public String getZkPath() {
     return _zkPath;
   }
@@ -150,9 +136,8 @@ public class HelixConfigScope {
   public String getMapKey() {
     return _mapKey;
   }
-  
+
   public boolean isFullKey() {
     return _isFullKey;
   }
 }
-


Mime
View raw message