use of org.apache.ignite.internal.UnregisteredBinaryTypeException in project ignite by apache.
the class GridCacheReturn method addEntryProcessResult.
/**
* @param cctx Context.
* @param key Key.
* @param key0 Key value.
* @param res Result.
* @param err Error.
* @param keepBinary Keep binary.
*/
public synchronized void addEntryProcessResult(GridCacheContext cctx, KeyCacheObject key, @Nullable Object key0, @Nullable Object res, @Nullable Exception err, boolean keepBinary) {
assert v == null || v instanceof Map : v;
assert key != null;
assert res != null || err != null;
invokeRes = true;
if (loc) {
HashMap<Object, EntryProcessorResult> resMap = (HashMap<Object, EntryProcessorResult>) v;
if (resMap == null) {
resMap = new HashMap<>();
v = resMap;
}
// These exceptions mean that we should register class and call EntryProcessor again.
if (err != null) {
if (err instanceof UnregisteredClassException)
throw (UnregisteredClassException) err;
else if (err instanceof UnregisteredBinaryTypeException)
throw (UnregisteredBinaryTypeException) err;
}
CacheInvokeResult res0 = err == null ? CacheInvokeResult.fromResult(res) : CacheInvokeResult.fromError(err);
Object resKey = key0 != null ? key0 : ((keepBinary && key instanceof BinaryObject) ? key : CU.value(key, cctx, true));
resMap.put(resKey, res0);
} else {
assert v == null;
assert cacheId == 0 || cacheId == cctx.cacheId();
cacheId = cctx.cacheId();
if (invokeResCol == null)
invokeResCol = new ArrayList<>();
CacheInvokeDirectResult res0 = err == null ? cctx.transactional() ? new CacheInvokeDirectResult(key, cctx.toCacheObject(res)) : CacheInvokeDirectResult.lazyResult(key, res) : new CacheInvokeDirectResult(key, err);
invokeResCol.add(res0);
}
}
Aggregations