Unnecessary log removal (#2208)
[helix.git] / recipes / rabbitmq-consumer-group / src / main / java / org / apache / helix / recipes / rabbitmq / SetupConsumerCluster.java
index 93aadb4ae91d5e5971fad95c8cb6a202cde6d7e2..c676272b19b070ab49bfe813d5be9513be4c57d5 100644 (file)
@@ -9,7 +9,7 @@ package org.apache.helix.recipes.rabbitmq;
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -21,22 +21,19 @@ package org.apache.helix.recipes.rabbitmq;
 
 import org.apache.helix.manager.zk.ZKHelixAdmin;
 import org.apache.helix.manager.zk.ZNRecordSerializer;
-import org.apache.helix.manager.zk.ZkClient;
-import org.apache.helix.model.IdealState.IdealStateModeProperty;
+import org.apache.helix.zookeeper.impl.client.ZkClient;
+import org.apache.helix.model.IdealState.RebalanceMode;
 import org.apache.helix.model.StateModelDefinition;
 import org.apache.helix.tools.StateModelConfigGenerator;
 
-public class SetupConsumerCluster
-{
+public class SetupConsumerCluster {
   public static final String DEFAULT_CLUSTER_NAME = "rabbitmq-consumer-cluster";
   public static final String DEFAULT_RESOURCE_NAME = "topic";
   public static final int DEFAULT_PARTITION_NUMBER = 6;
   public static final String DEFAULT_STATE_MODEL = "OnlineOffline";
 
-  public static void main(String[] args)
-  {
-    if (args.length < 1)
-    {
+  public static void main(String[] args) {
+    if (args.length < 1) {
       System.err.println("USAGE: java SetupConsumerCluster zookeeperAddress (e.g. localhost:2181)");
       System.exit(1);
     }
@@ -45,31 +42,28 @@ public class SetupConsumerCluster
     final String clusterName = DEFAULT_CLUSTER_NAME;
 
     ZkClient zkclient = null;
-    try
-    {
-      zkclient = new ZkClient(zkAddr, ZkClient.DEFAULT_SESSION_TIMEOUT,
-          ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
+    try {
+      zkclient =
+          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 state model definition
-      StateModelConfigGenerator generator = new StateModelConfigGenerator();
       admin.addStateModelDef(clusterName, DEFAULT_STATE_MODEL,
-          new StateModelDefinition(generator.generateConfigForOnlineOffline()));
+          new StateModelDefinition(StateModelConfigGenerator.generateConfigForOnlineOffline()));
 
       // add resource "topic" which has 6 partitions
       String resourceName = DEFAULT_RESOURCE_NAME;
       admin.addResource(clusterName, resourceName, DEFAULT_PARTITION_NUMBER, DEFAULT_STATE_MODEL,
-          IdealStateModeProperty.AUTO_REBALANCE.toString());
-      
+          RebalanceMode.FULL_AUTO.toString());
+
       admin.rebalance(clusterName, resourceName, 1);
 
-    } finally
-    {
-      if (zkclient != null)
-      {
+    } finally {
+      if (zkclient != null) {
         zkclient.close();
       }
     }