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


Java MutableEntry.setValue方法代码示例

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


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

示例1: process

import javax.cache.processor.MutableEntry; //导入方法依赖的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: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Long process(MutableEntry<GridCacheQueueHeaderKey, GridCacheQueueHeader> e, Object... args) {
    GridCacheQueueHeader hdr = e.getValue();

    boolean rmvd = queueRemoved(hdr, id);

    if (rmvd || !spaceAvailable(hdr, size))
        return rmvd ? QUEUE_REMOVED_IDX : null;

    GridCacheQueueHeader newHdr = new GridCacheQueueHeader(hdr.id(),
        hdr.capacity(),
        hdr.collocated(),
        hdr.head(),
        hdr.tail() + size,
        hdr.removedIndexes());

    e.setValue(newHdr);

    return hdr.tail();
}
 
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:GridCacheQueueAdapter.java

示例3: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Boolean 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 true;
    }

    return false;
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:GridCacheAtomicReferenceImpl.java

示例4: process

import javax.cache.processor.MutableEntry; //导入方法依赖的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

示例5: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Boolean process(MutableEntry<Object, Object> entry, Object... arguments)
    throws EntryProcessorException {
    if (entry.exists())
        return false;

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

示例6: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Integer process(MutableEntry<Integer, Integer> entry, Object... arguments)
    throws EntryProcessorException {
    entry.setValue(42);

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

示例7: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Object process(MutableEntry<Object, Object> e, Object... args) {
    Object old = retOld ? e.getValue() : null;

    if (val != null)
        e.setValue(val);
    else
        e.remove();

    return old;
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:CacheInterceptorPartitionCounterRandomOperationsTest.java

示例8: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Long process(MutableEntry<String, Long> entry,
    Object... arguments) throws EntryProcessorException {
    long newVal = entry.getValue() == null ? 0 : entry.getValue() + 1;

    entry.setValue(newVal);

    return newVal;
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:IgniteTransactionalInvokeRetryBenchmark.java

示例9: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Integer process(MutableEntry<String, Integer> entry, Object... arguments) {
    Integer currVal = entry.getValue();

    if (currVal == null)
        entry.setValue(0);
    else
        entry.setValue(currVal + 1);

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

示例10: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Object process(MutableEntry<Object, Object> e, Object... args) {
    if (skipModify)
        return null;

    Object old = retOld ? e.getValue() : null;

    if (val != null)
        e.setValue(val);
    else
        e.remove();

    return old;
}
 
开发者ID:apache,项目名称:ignite,代码行数:15,代码来源:CacheContinuousQueryRandomOperationsTest.java

示例11: process

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

示例12: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Integer process(MutableEntry<String, Integer> entry,
    Object... arguments) throws EntryProcessorException {
    Integer val = entry.getValue();

    entry.setValue(newVal);

    return val;
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:IgniteCacheConfigVariationsFullApiTest.java

示例13: testInvoke

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
@Test
public void testInvoke()
{
    final CacheLoader<String, Integer> cacheLoader = new CacheLoader<String, Integer>()
    {
        @Override
        public Integer load(String key)
            throws CacheLoaderException
        {
            return Integer.valueOf(key);
        }

        @Override
        public Map<String, Integer> loadAll(Iterable<? extends String> keys)
            throws CacheLoaderException
        {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    };

    final EntryProcessor<String, Integer, Boolean> entryProcessor = new EntryProcessor<String, Integer, Boolean>()
    {
        @Override
        public Boolean process(MutableEntry<String, Integer> entry, Object... arguments)
            throws EntryProcessorException
        {
            assertTrue(entry.exists());
            assertEquals(Integer.valueOf(1), entry.getValue());
            entry.setValue(2);
            assertEquals(Integer.valueOf(2), entry.getValue());
            entry.remove();
            assertFalse(entry.exists());

            return Boolean.TRUE;
        }
    };

    MutableConfiguration<String, Integer> custom = new MutableConfiguration<>(configuration);

    custom.setReadThrough(true);
    custom.setCacheLoaderFactory
    (
        new Factory<CacheLoader<String, Integer>>()
        {
            @Override
            public CacheLoader<String, Integer> create()
            {
                return cacheLoader;
            }
        }
    );

    Cache<String, Integer> invokingCache = cacheManager.createCache("invokingCache", custom);

    assertTrue(invokingCache.invoke("1", entryProcessor));
    assertFalse(invokingCache.containsKey("1"));
}
 
开发者ID:ocafebabe,项目名称:guava-jcache,代码行数:58,代码来源:GuavaCacheTest.java

示例14: process

import javax.cache.processor.MutableEntry; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Void process(MutableEntry<Integer, Integer> e, Object... args) {
    Integer val = e.getValue();

    if (val == null) {
        failed = true;

        System.out.println(Thread.currentThread() + " got null in processor: " + val);

        return null;
    }

    e.setValue(val + 1);

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

示例15: process

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

    Object val = entry.getValue();

    int valId = 0;

    if (val != null) {
        assertTrue(val instanceof BinaryObject);

        valId = valueOf(((BinaryObject)val).deserialize()) + 1;
    }

    Object newVal = value(valId, (DataMode)arguments[0]);

    assertFalse(newVal instanceof BinaryObject);

    entry.setValue(newVal);

    return val == null ? null : ((BinaryObject)val).deserialize();
}
 
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:WithKeepBinaryCacheFullApiTest.java


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