Search in sources :

Example 6 with UnregisteredBinaryTypeException

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);
    }
}
Also used : UnregisteredClassException(org.apache.ignite.internal.UnregisteredClassException) EntryProcessorResult(javax.cache.processor.EntryProcessorResult) UnregisteredBinaryTypeException(org.apache.ignite.internal.UnregisteredBinaryTypeException) BinaryObject(org.apache.ignite.binary.BinaryObject) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BinaryObject(org.apache.ignite.binary.BinaryObject) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

UnregisteredBinaryTypeException (org.apache.ignite.internal.UnregisteredBinaryTypeException)6 UnregisteredClassException (org.apache.ignite.internal.UnregisteredClassException)5 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 IgniteCacheRestartingException (org.apache.ignite.IgniteCacheRestartingException)2 CacheStoppedException (org.apache.ignite.internal.processors.cache.CacheStoppedException)2 GridCacheEntryRemovedException (org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException)2 GridDhtCacheEntry (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry)2 GridDhtInvalidPartitionException (org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException)2 IgniteBiTuple (org.apache.ignite.lang.IgniteBiTuple)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 BigDecimal (java.math.BigDecimal)1 Time (java.sql.Time)1 Timestamp (java.sql.Timestamp)1 Date (java.util.Date)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 UUID (java.util.UUID)1 EntryProcessor (javax.cache.processor.EntryProcessor)1