当前位置: 首页>>代码示例>>Java>>正文


Java EntryProcessorException类代码示例

本文整理汇总了Java中javax.cache.processor.EntryProcessorException的典型用法代码示例。如果您正苦于以下问题:Java EntryProcessorException类的具体用法?Java EntryProcessorException怎么用?Java EntryProcessorException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EntryProcessorException类属于javax.cache.processor包,在下文中一共展示了EntryProcessorException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
@Override public Object process(MutableEntry<BinaryObject, BinaryObject> entry,
    Object... arguments) throws EntryProcessorException {

    BinaryObject val = entry.getValue();

    /** The message will be printed on the node that stores the entry! */
    System.out.println(">> Before update:");
    System.out.println(val);

    if (increase)
        val = val.toBuilder().setField("POPULATION", (int)val.field("POPULATION") + delta).build();
    else
        val = val.toBuilder().setField("POPULATION", (int)val.field("POPULATION") - delta).build();

    entry.setValue(val);

    return entry;
}
 
开发者ID:dmagda,项目名称:ignite_world_demo,代码行数:19,代码来源:KeyValueBinaryDataProcessing.java

示例2: invoke

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
@Override
public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments) throws EntryProcessorException {
    
    try{
        if(key==null || entryProcessor==null)
            throw new NullPointerException("key or entryProcessor can not be null");
        
        verifyCacheConnectivity();
        
       return (T)innerCache.invokeEntryProcessor(key, new JCacheEntryProcessor(entryProcessor), arguments);
    }
    catch(Exception ex)
    {
        throw new EntryProcessorException(ex);
    }        
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:17,代码来源:TayzGridCache.java

示例3: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Boolean process(MutableEntry<Object, Object> entry, Object... arguments)
    throws EntryProcessorException {
    if (!entry.exists())
        return null; // Someone got ahead of us and removed this entry, let's skip it.

    Object entryVal = entry.getValue();

    if (entryVal == null)
        return null;

    // Something happened to the cache while we were performing map-reduce.
    if (!F.eq(entryVal, val))
        return false;

    entryModifier.apply(entry);

    return null; // To leave out only erroneous keys - nulls are skipped on results' processing.
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:DmlStatementsProcessor.java

示例4: testTxInvoke

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** */
public void testTxInvoke() throws Exception {
    executeWithAllTxCaches(new TestClosure() {
        @Override public void run() throws Exception {
            cache.put(key1, okValue);

            GridTestUtils.assertThrows(log, new Callable<Object>() {
                @Override public Object call() throws Exception {
                    try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
                        cache.invoke(key1, new TestEntryProcessor(badValue));

                        tx.commit();
                    }

                    return null;
                }
            }, EntryProcessorException.class, ERR_MSG);

            assertEquals(1, cache.size());
            assertEquals(okValue, cache.get(key1));
        }
    });
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:IgniteSqlNotNullConstraintTest.java

示例5: testTxInvokeAll

import javax.cache.processor.EntryProcessorException; //导入依赖的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());
        }
    });
}
 
开发者ID:apache,项目名称:ignite,代码行数:26,代码来源:IgniteSqlNotNullConstraintTest.java

示例6: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Object process(MutableEntry<String, Set> entry,
    Object... arguments) throws EntryProcessorException {
    assert !F.isEmpty(arguments);

    Object val = arguments[0];

    Set set;

    if (!entry.exists())
        set = new HashSet<>();
    else
        set = entry.getValue();

    set.add(val);

    entry.setValue(set);

    return null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:IgniteAtomicInvokeRetryBenchmark.java

示例7: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public IgfsEntryInfo process(MutableEntry<IgniteUuid, IgfsEntryInfo> entry, Object... args)
    throws EntryProcessorException {
    IgfsEntryInfo oldInfo = entry.getValue();

    Map<String, String> tmp = oldInfo.properties();

    tmp = tmp == null ? new GridLeanMap<String, String>(props.size()) : new GridLeanMap<>(tmp);

    for (Map.Entry<String, String> e : props.entrySet()) {
        if (e.getValue() == null)
            // Remove properties with 'null' values.
            tmp.remove(e.getKey());
        else
            // Add/overwrite property.
            tmp.put(e.getKey(), e.getValue());
    }

    IgfsEntryInfo newInfo = oldInfo.properties(tmp);

    entry.setValue(newInfo);

    return newInfo;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:IgfsMetaUpdatePropertiesProcessor.java

示例8: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public IgfsEntryInfo process(MutableEntry<IgniteUuid, IgfsEntryInfo> entry, Object... args)
    throws EntryProcessorException {

    IgfsEntryInfo info = IgfsUtils.createDirectory(
        entry.getKey(),
        null,
        props,
        accessTime,
        modificationTime
    );

    if (childName != null)
        info = info.listing(Collections.singletonMap(childName, childEntry));

    entry.setValue(info);

    return info;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:IgfsMetaDirectoryCreateProcessor.java

示例9: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public IgfsEntryInfo process(MutableEntry<IgniteUuid, IgfsEntryInfo> entry, Object... args)
    throws EntryProcessorException {
    IgfsEntryInfo info = IgfsUtils.createFile(
        entry.getKey(),
        blockSize,
        len,
        affKey,
        lockId,
        evictExclude,
        props,
        accessTime,
        modificationTime
    );

    entry.setValue(info);

    return info;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:IgfsMetaFileCreateProcessor.java

示例10: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Void process(MutableEntry<IgniteUuid, IgfsEntryInfo> e, Object... args)
    throws EntryProcessorException {
    IgfsEntryInfo fileInfo = e.getValue();

    assert fileInfo != null;
    assert fileInfo.isDirectory();

    Map<String, IgfsListingEntry> listing = new HashMap<>(fileInfo.listing());

    IgfsListingEntry oldEntry = listing.get(fileName);

    if (oldEntry == null || !oldEntry.fileId().equals(fileId))
        throw new IgniteException("Directory listing doesn't contain expected file" +
            " [listing=" + listing + ", fileName=" + fileName + "]");

    // Modify listing in-place.
    listing.remove(fileName);

    e.setValue(fileInfo.listing(listing));

    return null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:IgfsMetaDirectoryListingRemoveProcessor.java

示例11: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Object process(MutableEntry<String, PlatformDotNetSessionData> entry, Object... args)
    throws EntryProcessorException {
    if (!entry.exists())
        return null;

    PlatformDotNetSessionData data = entry.getValue();

    assert data != null;

    if (data.isLocked())
        return new PlatformDotNetSessionLockResult(false, null, data.lockTime(), data.lockId());

    // Not locked: lock and return result
    data = data.lock(lockNodeId, lockId, lockTime);

    // Apply.
    entry.setValue(data);

    return new PlatformDotNetSessionLockResult(true, data, null, data.lockId());
}
 
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:PlatformDotNetSessionLockProcessor.java

示例12: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Void process(MutableEntry<String, PlatformDotNetSessionData> entry, Object... args)
    throws EntryProcessorException {
    assert entry.exists();

    PlatformDotNetSessionData data = entry.getValue();

    assert data != null;

    // Unlock and update.
    data = update
        ? data.updateAndUnlock(lockNodeId, lockId, items, isDiff, staticData, timeout)
        : data.unlock(lockNodeId, lockId);

    // Apply.
    entry.setValue(data);

    return null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:PlatformDotNetSessionSetAndUnlockProcessor.java

示例13: convertException

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Exception convertException(Exception e) {
    if (e instanceof CachePartialUpdateException)
        return new PlatformCachePartialUpdateException((CachePartialUpdateCheckedException)e.getCause(),
            platformCtx, keepBinary);

    if (e instanceof CachePartialUpdateCheckedException)
        return new PlatformCachePartialUpdateException((CachePartialUpdateCheckedException)e, platformCtx, keepBinary);

    if (e.getCause() instanceof EntryProcessorException)
        return (Exception)e.getCause();

    TransactionDeadlockException deadlockException = X.cause(e, TransactionDeadlockException.class);

    if (deadlockException != null)
        return deadlockException;

    TransactionTimeoutException timeoutException = X.cause(e, TransactionTimeoutException.class);

    if (timeoutException != null)
        return timeoutException;

    return super.convertException(e);
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:PlatformCache.java

示例14: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Object process(MutableEntry entry, Object... args)
    throws EntryProcessorException {
    try {
        Ignite ignite = (Ignite)entry.unwrap(Ignite.class);

        PlatformProcessor interopProc;

        try {
            interopProc = PlatformUtils.platformProcessor(ignite);
        }
        catch (IllegalStateException ex){
            throw new EntryProcessorException(ex);
        }

        interopProc.awaitStart();

        return execute0(interopProc.context(), entry);
    }
    catch (IgniteCheckedException e) {
        throw U.convertException(e);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:PlatformCacheEntryProcessorImpl.java

示例15: process

import javax.cache.processor.EntryProcessorException; //导入依赖的package包/类
/** {@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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:17,代码来源:GridCacheAtomicStampedImpl.java


注:本文中的javax.cache.processor.EntryProcessorException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。