/** {@inheritDoc} */ @Override public T get() throws EntryProcessorException { if (err != null) { if (err instanceof UnregisteredClassException || err instanceof UnregisteredBinaryTypeException) throw (IgniteException) err; if (err instanceof EntryProcessorException) throw (EntryProcessorException)err; throw new EntryProcessorException(err); } return res; }
/** {@inheritDoc} */ @Override public Integer process(MutableEntry<String, Integer> e, Object... args) { throw new EntryProcessorException("Test entry processor exception."); } }
/** {@inheritDoc} */ @Override public Object process(MutableEntry<Object, Object> e, Object... args) { throw new EntryProcessorException("Test entry processor exception."); } }
@Override public Object process(final MutableEntry<Object, Object> entry, final Object... args) throws EntryProcessorException { try { sleepForTxFailure(); } catch (InterruptedException e) { throw new EntryProcessorException(e); } return null; } });
@SuppressWarnings("unchecked") @Override @Nullable public T process(MutableEntry<Object, Object> entry, Object... arguments) throws EntryProcessorException { Callable<T> valueLoader = (Callable<T>) arguments[0]; if (entry.exists()) { return (T) fromStoreValue(entry.getValue()); } else { T value; try { value = valueLoader.call(); } catch (Exception ex) { throw new EntryProcessorException("Value loader '" + valueLoader + "' failed " + "to compute value for key '" + entry.getKey() + "'", ex); } entry.setValue(toStoreValue(value)); return value; } } }
@Override public Object process(MutableEntry<Integer, Integer> entry, Object... arguments) throws EntryProcessorException { entry.setValue(1); try { Thread.sleep(100); } catch (InterruptedException e) { throw new EntryProcessorException(e); } return null; } });
@Override public Object process(MutableEntry<Integer, Integer> entry, Object... arguments) throws EntryProcessorException { entry.setValue(1); try { Thread.sleep(200); } catch (InterruptedException e) { throw new EntryProcessorException(e); } return null; } });
/** {@inheritDoc} */ @Override public Integer process(MutableEntry<Integer, Integer> e, Object... arguments) throws EntryProcessorException { assertTrue(e.exists()); if (expVal != null) assertEquals(expVal, e.getValue()); throw new EntryProcessorException("Test processor exception."); }
/** {@inheritDoc} */ @Override public Void process(MutableEntry<GridCacheInternalKey, GridCacheAtomicReferenceValue<T>> e, Object... args) { GridCacheAtomicReferenceValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic reference with given name: " + e.getKey().name()); e.setValue(new GridCacheAtomicReferenceValue<>(newVal)); return null; }
/** {@inheritDoc} */ @Override public Void process(MutableEntry<GridCacheInternalKey, GridCacheAtomicStampedValue<T, S>> e, Object... args) { GridCacheAtomicStampedValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic stamped with given name: " + e.getKey().name()); e.setValue(new GridCacheAtomicStampedValue<>(newVal, newStamp)); return null; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); e.setValue(new GridCacheAtomicLongValue(newVal)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() + delta; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() + 1; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() - 1; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); e.setValue(new GridCacheAtomicLongValue(curVal + delta)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); if (curVal == expVal) e.setValue(new GridCacheAtomicLongValue(newVal)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long ret = val.get(); e.setValue(new GridCacheAtomicLongValue(ret + 1)); return ret; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long ret = val.get(); e.setValue(new GridCacheAtomicLongValue(ret - 1)); return ret; }
/** {@inheritDoc} */ @Override public T process(MutableEntry<GridCacheInternalKey, GridCacheAtomicReferenceValue<T>> e, Object... args) { GridCacheAtomicReferenceValue<T> val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic reference with given name: " + e.getKey().name()); T curVal = val.get(); if (F.eq(expVal, curVal)) e.setValue(new GridCacheAtomicReferenceValue<T>(newVal)); return curVal; }
/** {@inheritDoc} */ @Override public Boolean process(MutableEntry<GridCacheInternalKey, GridCacheAtomicStampedValue<T, S>> e, Object... args) { GridCacheAtomicStampedValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic stamped with given name: " + e.getKey().name()); if (F.eq(expVal, val.value()) && F.eq(expStamp, val.stamp())) { e.setValue(new GridCacheAtomicStampedValue<>(newVal, newStamp)); return true; } return false; }