Yuta HIGUCHI | 8aa2f9b | 2014-07-28 11:33:45 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.datagrid; |
| 2 | |
| 3 | import com.hazelcast.config.Config; |
| 4 | import com.hazelcast.config.ExecutorConfig; |
| 5 | import com.hazelcast.core.Hazelcast; |
| 6 | import com.hazelcast.core.HazelcastInstance; |
| 7 | import com.hazelcast.examples.TestApp; |
| 8 | |
| 9 | /** |
| 10 | * Hazelcast CLI. |
| 11 | */ |
| 12 | public class HazelcastCLI extends TestApp { |
| 13 | |
| 14 | private static final int LOAD_EXECUTORS_COUNT = 16; |
| 15 | |
| 16 | /** |
| 17 | * hazelcast CLI. |
| 18 | * |
| 19 | * @param hazelcast Hazelcast instance. |
| 20 | */ |
| 21 | public HazelcastCLI(HazelcastInstance hazelcast) { |
| 22 | super(hazelcast); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * {@link TestApp} modified to read conf/hazelcast.xml. |
| 27 | * |
| 28 | * @param args none expected |
| 29 | * @throws Exception exception |
| 30 | */ |
| 31 | public static void main(String[] args) throws Exception { |
| 32 | final String configFilename = System.getProperty( |
| 33 | "net.onrc.onos.core.datagrid.HazelcastDatagrid.datagridConfig", |
| 34 | "conf/hazelcast.xml"); |
| 35 | Config config = HazelcastDatagrid.loadHazelcastConfig(configFilename); |
| 36 | |
| 37 | for (int k = 1; k <= LOAD_EXECUTORS_COUNT; k++) { |
| 38 | config.addExecutorConfig(new ExecutorConfig("e" + k).setPoolSize(k)); |
| 39 | } |
| 40 | |
Yuta HIGUCHI | 448bca0 | 2014-08-13 17:08:00 -0700 | [diff] [blame] | 41 | HazelcastCLI cli = new HazelcastCLI(Hazelcast.getOrCreateHazelcastInstance(config)); |
Yuta HIGUCHI | 8aa2f9b | 2014-07-28 11:33:45 -0700 | [diff] [blame] | 42 | cli.start(args); |
| 43 | } |
| 44 | |
| 45 | } |