private void printQueueCommands() { println("-- Queue commands"); println("q.offer <string> //adds a string object to the queue"); println("q.poll //takes an object from the queue"); println("q.offermany <number> [<size>] //adds indicated number of string objects to the queue ('obj<i>' or " + "byte[<size>]) "); println("q.pollmany <number> //takes indicated number of objects from the queue"); println("q.iterator [remove] //iterates the queue, remove if specified"); println("q.size //size of the queue"); println("q.clear //clears the queue"); println(""); }
private void printExecutorServiceCommands() { println("-- Executor Service commands:"); println("execute <echo-input> //executes an echo task on random member"); println("executeOnKey <echo-input> <key> //executes an echo task on the member that owns the given key"); println("executeOnMember <echo-input> <memberIndex> //executes an echo task on the member with given index"); println("executeOnMembers <echo-input> //executes an echo task on all of the members"); println("e<threadcount>.simulateLoad <task-count> <delaySeconds> //simulates load on executor with given number " + "of thread (e1..e16)"); println(""); }
private void printLockCommands() { println("-- Lock commands"); println("lock <key> //same as Hazelcast.getLock(key).lock()"); println("tryLock <key> //same as Hazelcast.getLock(key).tryLock()"); println("tryLock <key> <time> //same as tryLock <key> with timeout in seconds"); println("unlock <key> //same as Hazelcast.getLock(key).unlock()"); println(""); }
private void handleNamespace(String namespace) { if (!namespace.isEmpty()) { this.namespace = namespace; } println("namespace: " + namespace); }
protected void handleMapPut(String[] args) { if (args.length == 1) { println("m.put requires a key and a value. You have not specified either."); } else if (args.length == 2) { println("m.put requires a key and a value. You have only specified the key " + args[1]); } else if (args.length > 3) { println("m.put takes two arguments, a key and a value. You have specified more than two arguments."); } else { println(getMap().put(args[1], args[2])); } }
private void handStats(String[] args) { String iteratorStr = args[0]; if (iteratorStr.startsWith("m.")) { println(getMap().getLocalMapStats()); } else if (iteratorStr.startsWith("mm.")) { println(getMultiMap().getLocalMultiMapStats()); } else if (iteratorStr.startsWith("q.")) { println(getQueue().getLocalQueueStats()); } }
protected void handleMapPutAsync(String[] args) { try { println(getMap().putAsync(args[1], args[2]).get()); } catch (InterruptedException e) { currentThread().interrupt(); e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
protected void handleMapGetAsync(String[] args) { try { println(getMap().getAsync(args[1]).get()); } catch (InterruptedException e) { currentThread().interrupt(); e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
protected void handleMapGetMany(String[] args) { int count = 1; if (args.length > 1) { count = Integer.parseInt(args[1]); } for (int i = 0; i < count; i++) { println(getMap().get("key" + i)); } }
protected void handleMapPutAsync(String[] args) { try { println(getMap().putAsync(args[1], args[2]).get()); } catch (InterruptedException e) { currentThread().interrupt(); e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
private void handleAtomicNumberSet(String[] args) { long v = 0; if (args.length > 1) { v = Long.parseLong(args[1]); } getAtomicNumber().set(v); println(getAtomicNumber().get()); }