@Override public ICompletableFuture<V> putAsync(K key, V value) { return map.putAsync(key, value); }
@Override public V put(K k, V v) { delegate.putAsync(k,v); return null; }
@Override ICompletableFuture storeAsync(K key, V value) { return (ICompletableFuture) map.putAsync(key, value); } }
@Override public void putAll(Map<? extends K, ? extends V> map) { for(Entry<? extends K, ? extends V> entry : map.entrySet()) { delegate.putAsync(entry.getKey(),entry.getValue()); } }
@Override public void putAll(Map<? extends K, ? extends V> map) { for(Entry<? extends K, ? extends V> entry : map.entrySet()) { delegate.putAsync(entry.getKey(),entry.getValue()); } }
/** * Asynchronously put the work into the pending map so we can work on submitting it to the worker * if we wanted. Could possibly cause duplicate work if we execute the work, then add to the map. * @param task * @return */ public Future<HazeltaskTask<GROUP>> addPendingTaskAsync(HazeltaskTask<GROUP> task) { return pendingTask.putAsync(task.getId(), task); }
public void run() { IMap map = hazelcast.getMap("myMap"); try { map.putAsync(random.nextInt(SIZE), new Customer(random.nextInt(100), String.valueOf(random.nextInt(10000))) ).get(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } }, 5);
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 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 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 handleMapPutAsync(String[] args) { try { println(getMap().putAsync(args[1], args[2]).get()); } catch (InterruptedException e) { currentThread().interrupt(); e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
@Override public <T> void put(String appid, String id, T object, Long ttlSeconds) { if (!StringUtils.isBlank(id) && object != null && !StringUtils.isBlank(appid)) { logger.debug("Cache.put() {} {} ttl {}", appid, id, ttlSeconds); if (isAsyncEnabled()) { client().getMap(appid).putAsync(id, object, ttlSeconds, TimeUnit.SECONDS); } else { client().getMap(appid).put(id, object, ttlSeconds, TimeUnit.SECONDS); } } }
@TimeStep(prob = 0.2) public void putAsync(ThreadState state) { int key = state.randomInt(keyCount); Object value = state.randomInt(); map.putAsync(key, value); count.putAsyncCount.incrementAndGet(); }
@TimeStep(prob = 0.2) public void putAsync(BaseThreadState state) { int key = state.randomInt(keyCount); Object value = state.randomInt(); map.putAsync(key, value); count.putAsyncCount.incrementAndGet(); }
@TimeStep(prob = 0.2) public void putAsyncTTL(ThreadState state) { int key = state.randomInt(keyCount); Object value = state.randomInt(); int delay = 1 + state.randomInt(maxTTLExpirySeconds); map.putAsync(key, value, delay, TimeUnit.SECONDS); count.putAsyncTTLCount.incrementAndGet(); }
@TimeStep public void timeStep(ThreadState state) throws Exception { if (!state.semaphore.tryAcquire(1, acquireTimeoutMs, MILLISECONDS)) { throw new TestException("Failed to acquire a license from the semaphore within the given timeout"); } String key = keys[state.randomInt(keyCount)]; ICompletableFuture<String> f = (ICompletableFuture<String>) map.putAsync(key, ""); f.andThen(state); }
@TimeStep(prob = 0.2) public void putAsyncTTL(BaseThreadState state) { int key = state.randomInt(keyCount); int value = state.randomInt(); int delay = 1 + state.randomInt(maxTTLExpirySeconds); map.putAsync(key, value, delay, TimeUnit.SECONDS); count.putAsyncTTLCount.incrementAndGet(); }
@TimeStep public void timeStep(ThreadState state) throws Exception { if (!state.semaphore.tryAcquire(1, acquireTimeoutMs, TimeUnit.MILLISECONDS)) { throw new TestException("Failed to acquire a license from the semaphore within the given timeout"); } String key = keys[state.randomInt(keyCount)]; ICompletableFuture<String> f = (ICompletableFuture<String>) map.putAsync(key, ""); f.andThen(state); }
@TimeStep(prob = 0.3) public void putAsyncTTL(ThreadState state) { try { int key = state.randomInt(keyCount); int value = state.randomInt(); int delayMs = minTTLExpiryMs + state.randomInt(maxTTLExpiryMs); map.putAsync(key, value, delayMs, TimeUnit.MILLISECONDS); state.count.putAsyncTTLCount.incrementAndGet(); } catch (DistributedObjectDestroyedException e) { EmptyStatement.ignore(e); } }
@TimeStep(prob = 0.3) public void putAsyncTTL(ThreadState state) { try { int key = state.randomInt(keyCount); int value = state.randomInt(); int delayMs = minTTLExpiryMs + state.randomInt(maxTTLExpiryMs); map.putAsync(key, value, delayMs, TimeUnit.MILLISECONDS); state.count.putAsyncTTLCount.incrementAndGet(); } catch (DistributedObjectDestroyedException e) { EmptyStatement.ignore(e); } }