/** {@inheritDoc} */ @Override public final V getAndPut(K key, V val) throws IgniteCheckedException { return getAndPut(key, val, null); }
/** {@inheritDoc} */ @Nullable @Override public final V getAndPutIfAbsent(final K key, final V val) throws IgniteCheckedException { return getAndPut(key, val, ctx.noVal()); }
/** {@inheritDoc} */ @Nullable @Override public final V getAndReplace(final K key, final V val) throws IgniteCheckedException { return getAndPut(key, val, ctx.hasVal()); }
@Override public Object call() throws Exception { for (int i = 0; i < keyCnt; i++) { c.getAndPut(i, new H2TextValue(txt)); if (i % logFreq == 0) X.println("Stored values: " + i); } return null; } }, 1);
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public boolean offer(T item) throws IgniteException { try { Long idx = transformHeader(new AddProcessor(id, 1)); if (idx == null) return false; checkRemoved(idx); QueueItemKey key = itemKey(idx); cache.getAndPut(key, item); return true; } catch (IgniteCheckedException e) { throw U.convertException(e); } }
@Override public Boolean call() throws Exception { boolean retVal; try (GridNearTxLocal tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { Long idx = (Long)cache.invoke(queueKey, new AddProcessor(id, 1)).get(); if (idx != null) { checkRemoved(idx); cache.getAndPut(itemKey(idx), item); retVal = true; } else retVal = false; tx.commit(); return retVal; } } });
/** {@inheritDoc} */ @Override public final V getAndPut(K key, V val) throws IgniteCheckedException { return getAndPut(key, val, null); }
/** {@inheritDoc} */ @Nullable @Override public final V getAndReplace(final K key, final V val) throws IgniteCheckedException { return getAndPut(key, val, ctx.hasVal()); }
/** {@inheritDoc} */ @Nullable @Override public final V getAndPutIfAbsent(final K key, final V val) throws IgniteCheckedException { return getAndPut(key, val, ctx.noVal()); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public boolean offer(T item) throws IgniteException { try { Long idx = transformHeader(new AddProcessor(id, 1)); if (idx == null) return false; checkRemoved(idx); QueueItemKey key = itemKey(idx); cache.getAndPut(key, item); return true; } catch (IgniteCheckedException e) { throw U.convertException(e); } }
@Override public Boolean call() throws Exception { boolean retVal; try (GridNearTxLocal tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { Long idx = (Long)cache.invoke(queueKey, new AddProcessor(id, 1)).get(); if (idx != null) { checkRemoved(idx); cache.getAndPut(itemKey(idx), item); retVal = true; } else retVal = false; tx.commit(); return retVal; } } });