@SuppressWarnings({"LockAcquiredButNotSafelyReleased", "squid:S2222"}) protected void handleLock(String[] args) { String lockStr = args[0]; String key = args[1]; Lock lock = hazelcast.getLock(key); if (equalsIgnoreCase(lockStr, "lock")) { lock.lock(); println("true"); } else if (equalsIgnoreCase(lockStr, "unlock")) { lock.unlock(); println("true"); } else if (equalsIgnoreCase(lockStr, "trylock")) { String timeout = args.length > 2 ? args[2] : null; if (timeout == null) { println(lock.tryLock()); } else { long time = Long.parseLong(timeout); try { println(lock.tryLock(time, TimeUnit.SECONDS)); } catch (InterruptedException e) { currentThread().interrupt(); e.printStackTrace(); } } } }
@SuppressWarnings({"LockAcquiredButNotSafelyReleased", "squid:S2222"}) protected void handleLock(String[] args) { String lockStr = args[0]; String key = args[1]; Lock lock = hazelcast.getLock(key); if (equalsIgnoreCase(lockStr, "lock")) { lock.lock(); println("true"); } else if (equalsIgnoreCase(lockStr, "unlock")) { lock.unlock(); println("true"); } else if (equalsIgnoreCase(lockStr, "trylock")) { String timeout = args.length > 2 ? args[2] : null; if (timeout == null) { println(lock.tryLock()); } else { long time = Long.parseLong(timeout); try { println(lock.tryLock(time, TimeUnit.SECONDS)); } catch (InterruptedException e) { currentThread().interrupt(); e.printStackTrace(); } } } }
} else if ("silent".equals(first)) { silent = Boolean.parseBoolean(args[1]); } else if (equalsIgnoreCase("shutdown", first)) { handleShutdown(); } else if ("echo".equals(first)) { } else if (first.equals("m.replace")) { handleMapReplace(args); } else if (equalsIgnoreCase(first, "m.putIfAbsent")) { handleMapPutIfAbsent(args); } else if (first.equals("m.putAsync")) { } else if (first.equals("m.get")) { handleMapGet(args); } else if (equalsIgnoreCase(first, "m.getMapEntry")) { handleMapGetMapEntry(args); } else if (first.equals("m.remove")) { } else if (first.equals("m.evict")) { handleMapEvict(args); } else if (first.equals("m.putmany") || equalsIgnoreCase(first, "m.putAll")) { handleMapPutMany(args); } else if (first.equals("m.getmany")) { } else if (first.equals("m.removemany")) { handleMapRemoveMany(args); } else if (equalsIgnoreCase(command, "m.localKeys")) { handleMapLocalKeys(); } else if (equalsIgnoreCase(command, "m.localSize")) {
} else if ("silent".equals(first)) { silent = Boolean.parseBoolean(args[1]); } else if (equalsIgnoreCase("shutdown", first)) { handleShutdown(); } else if ("echo".equals(first)) { } else if (first.equals("m.replace")) { handleMapReplace(args); } else if (equalsIgnoreCase(first, "m.putIfAbsent")) { handleMapPutIfAbsent(args); } else if (first.equals("m.putAsync")) { } else if (first.equals("m.get")) { handleMapGet(args); } else if (equalsIgnoreCase(first, "m.getMapEntry")) { handleMapGetMapEntry(args); } else if (first.equals("m.remove")) { } else if (first.equals("m.evict")) { handleMapEvict(args); } else if (first.equals("m.putmany") || equalsIgnoreCase(first, "m.putAll")) { handleMapPutMany(args); } else if (first.equals("m.getmany")) { } else if (first.equals("m.removemany")) { handleMapRemoveMany(args); } else if (equalsIgnoreCase(command, "m.localKeys")) { handleMapLocalKeys(); } else if (equalsIgnoreCase(command, "m.localSize")) {