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


Java MutableEntry类代码示例

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


MutableEntry类属于javax.cache.processor包,在下文中一共展示了MutableEntry类的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 Void process(MutableEntry<String, WebSession> entry, Object... args) {
    if (!entry.exists())
        return null;

    WebSession ses0 = entry.getValue();

    WebSession ses = new WebSession(ses0.getId(), ses0);

    for (T2<String, Object> update : updates) {
        String name = update.get1();

        assert name != null;

        Object val = update.get2();

        if (val != null)
            ses.setAttribute(name, val);
        else
            ses.removeAttribute(name);
    }

    entry.setValue(ses);

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

示例3: process

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

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

示例5: process

import javax.cache.processor.MutableEntry; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Void process(MutableEntry<IgfsBlockKey, byte[]> entry, Object... args) {
    byte[] e = entry.getValue();

    final int size = data.length;

    if (e == null || e.length == 0)
        e = new byte[start + size]; // Don't allocate more, then required.
    else if (e.length < start + size) {
        // Expand stored data array, if it less, then required.
        byte[] tmp = new byte[start + size]; // Don't allocate more than required.

        U.arrayCopy(e, 0, tmp, 0, e.length);

        e = tmp;
    }

    // Copy data into entry.
    U.arrayCopy(data, 0, e, start, size);

    entry.setValue(e);

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

示例6: process

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

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

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

    // Modify listing in-place.
    IgfsListingEntry oldEntry = listing.put(fileName, entry);

    if (oldEntry != null && !oldEntry.fileId().equals(entry.fileId())) {
        throw new IgniteException("Directory listing contains unexpected file" +
            " [listing=" + listing + ", fileName=" + fileName + ", entry=" + entry +
            ", oldEntry=" + oldEntry + ']');
    }

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

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

示例7: process

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

示例8: process

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

示例9: process

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

示例10: process

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

示例11: process

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

示例12: writeEntryAndProcessor

import javax.cache.processor.MutableEntry; //导入依赖的package包/类
/**
 * Writes mutable entry and entry processor to the stream.
 *
 * @param entry Entry to process.
 * @param writer Writer.
 */
private void writeEntryAndProcessor(MutableEntry entry, BinaryRawWriter writer) {
    if (ptr != 0) {
        // Execute locally - we have a pointer to native processor.
        writer.writeBoolean(true);
        writer.writeLong(ptr);
    }
    else {
        // We are on a remote node. Send processor holder back to native.
        writer.writeBoolean(false);
        writer.writeObject(proc);
    }

    writer.writeObject(entry.getKey());
    writer.writeObject(entry.getValue());
}
 
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:PlatformCacheEntryProcessorImpl.java

示例13: process

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

    boolean rmvd = queueRemoved(hdr, id);

    if (rmvd)
        return new IgniteBiTuple<>(QUEUE_REMOVED_IDX, QUEUE_REMOVED_IDX);
    else if (hdr.empty())
        return null;

    GridCacheQueueHeader newHdr = new GridCacheQueueHeader(hdr.id(),
        hdr.capacity(),
        hdr.collocated(),
        hdr.tail(),
        hdr.tail(),
        null);

    e.setValue(newHdr);

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

示例14: process

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

    assertNotNull(ignite);

    if (e.exists()) {
        Integer val = e.getValue();

        assertNotNull(val);

        e.setValue(val + 1);

        assertTrue(e.exists());

        assertEquals(val + 1, (int) e.getValue());

        return val;
    }
    else {
        e.setValue(1);

        return -1;
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:27,代码来源:IgniteCacheInvokeAbstractTest.java

示例15: process

import javax.cache.processor.MutableEntry; //导入依赖的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.MutableEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。