本文整理汇总了Java中javax.cache.processor.EntryProcessorResult类的典型用法代码示例。如果您正苦于以下问题:Java EntryProcessorResult类的具体用法?Java EntryProcessorResult怎么用?Java EntryProcessorResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntryProcessorResult类属于javax.cache.processor包,在下文中一共展示了EntryProcessorResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAtomicOrImplicitTxInvokeAll
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** */
public void testAtomicOrImplicitTxInvokeAll() throws Exception {
executeWithAllCaches(new TestClosure() {
@Override public void run() throws Exception {
final Map<Integer, EntryProcessorResult<Object>> r = cache.invokeAll(F.asMap(
key1, new TestEntryProcessor(okValue),
key2, new TestEntryProcessor(badValue)));
assertNotNull(r);
GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
@Override public Object call() throws Exception {
return r.get(key2).get();
}
}, IgniteCheckedException.class, ERR_MSG);
assertEquals(1, cache.size());
}
});
}
示例2: testTxInvokeAll
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** */
public void testTxInvokeAll() throws Exception {
executeWithAllTxCaches(new TestClosure() {
@Override public void run() throws Exception {
try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
final Map<Integer, EntryProcessorResult<Object>> r = cache.invokeAll(F.asMap(
key1, new TestEntryProcessor(okValue),
key2, new TestEntryProcessor(badValue)));
assertNotNull(r);
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
return r.get(key2).get();
}
}, EntryProcessorException.class, ERR_MSG);
tx.rollback();
}
assertEquals(0, cache.size());
}
});
}
示例3: startBackgroundCleanup
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/**
* Starts the background cleanup of old cache entries.
*
* @param grid Grid.
* @param metaCache Meta cache.
* @param dataCacheName Data cache name.
* @param currentVersions Current versions.
*/
private void startBackgroundCleanup(Ignite grid, final Cache<CleanupNodeId, UUID> metaCache,
final String dataCacheName, final Map<String, EntryProcessorResult<Long>> currentVersions) {
if (cleanupFlags.containsKey(dataCacheName))
return; // Current node already performs cleanup.
if (!trySetGlobalCleanupFlag(grid, metaCache))
return;
cleanupFlags.put(dataCacheName, true);
final ClusterGroup dataNodes = grid.cluster().forDataNodes(dataCacheName);
IgniteFuture f = grid.compute(dataNodes).broadcastAsync(
new RemoveOldEntriesRunnable(dataCacheName, currentVersions));
f.listen(new CleanupCompletionListener(metaCache, dataCacheName));
}
示例4: invokeAllAsync
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <T> IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(
Set<? extends K> keys,
final EntryProcessor<K, V, T> entryProcessor,
Object... args) {
A.notNull(keys, "keys", entryProcessor, "entryProcessor");
if (keyCheck)
validateCacheKeys(keys);
Map<? extends K, EntryProcessor> invokeMap = F.viewAsMap(keys, new C1<K, EntryProcessor>() {
@Override public EntryProcessor apply(K k) {
return entryProcessor;
}
});
return updateAllAsync0(null,
invokeMap,
args,
true,
false,
null);
}
示例5: invokeAll
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(
Map<? extends K, ? extends EntryProcessor<K, V, T>> map,
Object... args) throws IgniteCheckedException {
A.notNull(map, "map");
if (keyCheck)
validateCacheKeys(map.keySet());
CacheOperationContext opCtx = ctx.operationContextPerCall();
return (Map<K, EntryProcessorResult<T>>)updateAllInternal(TRANSFORM,
map.keySet(),
map.values(),
args,
expiryPerCall(),
false,
false,
null,
ctx.writeThrough(),
ctx.readThrough(),
opCtx != null && opCtx.isKeepBinary());
}
示例6: unwrapInvokeResult
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/**
* @param resMap Invoke results map.
* @param keepBinary Keep binary flag.
* @return Unwrapped results.
*/
public Map unwrapInvokeResult(@Nullable Map<Object, EntryProcessorResult> resMap, final boolean keepBinary) {
return F.viewReadOnly(resMap, new C1<EntryProcessorResult, EntryProcessorResult>() {
@Override public EntryProcessorResult apply(EntryProcessorResult res) {
if (res instanceof CacheInvokeResult) {
CacheInvokeResult invokeRes = (CacheInvokeResult)res;
if (invokeRes.result() != null)
res = CacheInvokeResult.fromResult(unwrapBinaryIfNeeded(invokeRes.result(),
keepBinary, false));
}
return res;
}
});
}
示例7: invokeAll
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(
final Map<? extends K, ? extends EntryProcessor<K, V, T>> map,
final Object... args) throws IgniteCheckedException {
A.notNull(map, "map");
if (keyCheck)
validateCacheKeys(map.keySet());
return syncOp(new SyncOp<Map<K, EntryProcessorResult<T>>>(map.size() == 1) {
@Nullable @Override public Map<K, EntryProcessorResult<T>> op(GridNearTxLocal tx)
throws IgniteCheckedException {
IgniteInternalFuture<GridCacheReturn> fut =
tx.invokeAsync(ctx, null, (Map<? extends K, ? extends EntryProcessor<K, V, Object>>)map, args);
return fut.get().value();
}
});
}
示例8: invoke
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... args)
throws EntryProcessorException {
try {
if (isAsync()) {
setFuture(invokeAsync0(key, entryProcessor, args));
return null;
}
else {
EntryProcessorResult<T> res = delegate.invoke(key, entryProcessor, args);
return res != null ? res.get() : null;
}
}
catch (IgniteCheckedException | IgniteException e) {
throw cacheException(e);
}
}
示例9: invokeAsync0
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/**
* Invoke async operation internal implementation.
*
* @param key Key.
* @param entryProcessor Processor.
* @param args Arguments.
* @return Internal future.
*/
private <T> IgniteInternalFuture<T> invokeAsync0(K key, EntryProcessor<K, V, T> entryProcessor, Object[] args) {
IgniteInternalFuture<EntryProcessorResult<T>> fut = delegate.invokeAsync(key, entryProcessor, args);
return fut.chain(new CX1<IgniteInternalFuture<EntryProcessorResult<T>>, T>() {
@Override public T applyx(IgniteInternalFuture<EntryProcessorResult<T>> fut1)
throws IgniteCheckedException {
try {
EntryProcessorResult<T> res = fut1.get();
return res != null ? res.get() : null;
}
catch (RuntimeException e) {
throw new GridClosureException(e);
}
}
});
}
示例10: invokeAll
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
EntryProcessor<K, V, T> entryProcessor,
Object... args) {
try {
if (isAsync()) {
setFuture(delegate.invokeAllAsync(keys, entryProcessor, args));
return null;
}
else
return delegate.invokeAll(keys, entryProcessor, args);
}
catch (IgniteCheckedException | IgniteException e) {
throw cacheException(e);
}
}
示例11: invokeAll
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(
Map<? extends K, ? extends EntryProcessor<K, V, T>> map,
Object... args) throws IgniteCheckedException {
A.notNull(map, "map");
if (keyCheck)
validateCacheKeys(map.keySet());
return (Map<K, EntryProcessorResult<T>>)updateAll0(null,
map,
args,
null,
null,
false,
false,
TRANSFORM,
false).get();
}
示例12: invokeAllAsync
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <T> IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(
Map<? extends K, ? extends EntryProcessor<K, V, T>> map,
Object... args) {
A.notNull(map, "map");
if (keyCheck)
validateCacheKeys(map.keySet());
return updateAll0(null,
map,
args,
null,
null,
false,
false,
TRANSFORM,
true);
}
示例13: innerUpdateLocal
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public GridTuple3<Boolean, Object, EntryProcessorResult<Object>> innerUpdateLocal(
GridCacheVersion ver,
GridCacheOperation op,
@Nullable Object writeObj,
@Nullable Object[] invokeArgs,
boolean writeThrough,
boolean readThrough,
boolean retval,
boolean keepBinary,
@Nullable ExpiryPolicy expiryPlc,
boolean evt,
boolean metrics,
@Nullable CacheEntryPredicate[] filter,
boolean intercept,
UUID subjId,
String taskName)
throws IgniteCheckedException, GridCacheEntryRemovedException {
return new GridTuple3<>(false, null, null);
}
示例14: checkInvokeAllResult
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/**
* @param cache Cache.
* @param resMap Result map.
* @param expRes Expected result.
* @param cacheVal Expected cache value for key.
* @param deserializeRes Deseriallize result flag.
*/
private void checkInvokeAllResult(IgniteCache cache, Map<Object, EntryProcessorResult<Object>> resMap,
Object expRes, Object cacheVal, boolean deserializeRes) {
for (Map.Entry<Object, EntryProcessorResult<Object>> e : resMap.entrySet()) {
info("Key: " + e.getKey());
assertTrue("Wrong key type, binary object expected: " + e.getKey(), e.getKey() instanceof BinaryObject);
Object res = e.getValue().get();
// TODO IGNITE-2953: delete the following if when the issue wiil be fixed.
if (deserializeRes)
assertEquals(expRes, deserializeRes ? deserializeBinary(res) : res);
if (cache.get(e.getKey()) == null)
cache.get(e.getKey());
assertEquals(cacheVal, deserializeBinary(cache.get(e.getKey())));
}
}
示例15: checkInvokeAllAsyncResult
import javax.cache.processor.EntryProcessorResult; //导入依赖的package包/类
/**
* @param cache Cache.
* @param resMap Result map.
* @param expRes Expected result.
* @param cacheVal Expected cache value for key.
* @param deserializeRes Deseriallize result flag.
*/
private void checkInvokeAllAsyncResult(IgniteCache cache, Map<Object, EntryProcessorResult<Object>> resMap,
Object expRes, Object cacheVal, boolean deserializeRes) {
for (Map.Entry<Object, EntryProcessorResult<Object>> e : resMap.entrySet()) {
info("Key: " + e.getKey());
assertTrue("Wrong key type, binary object expected: " + e.getKey(), e.getKey() instanceof BinaryObject);
Object res = e.getValue().get();
// TODO IGNITE-2953: delete the following if when the issue wiil be fixed.
if (deserializeRes)
assertEquals(expRes, deserializeRes ? deserializeBinary(res) : res);
assertEquals(cacheVal, deserializeBinary(cache.getAsync(e.getKey()).get()));
}
}