本文整理汇总了Java中com.hazelcast.map.EntryProcessor类的典型用法代码示例。如果您正苦于以下问题:Java EntryProcessor类的具体用法?Java EntryProcessor怎么用?Java EntryProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntryProcessor类属于com.hazelcast.map包,在下文中一共展示了EntryProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMapP
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
@Nonnull
@SuppressWarnings("unchecked")
public static <T, K, V> ProcessorMetaSupplier updateMapP(
@Nonnull String name,
@Nullable ClientConfig clientConfig,
@Nonnull DistributedFunction<T, K> toKeyFn,
@Nonnull DistributedFunction<T, EntryProcessor<K, V>> toEntryProcessorFn
) {
boolean isLocal = clientConfig == null;
return dontParallelize(new EntryProcessorWriterSupplier<>(
name,
serializableConfig(clientConfig),
toKeyFn,
toEntryProcessorFn,
isLocal
)
);
}
示例2: tryProcess
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
@Override
protected boolean tryProcess(int ordinal, @Nonnull Object object) throws Exception {
checkError();
if (!tryIncrement(numConcurrentOps, 1, MAX_PARALLEL_ASYNC_OPS)) {
return false;
}
try {
T item = (T) object;
EntryProcessor<K, V> entryProcessor = toEntryProcessorFn.apply(item);
K key = toKeyFn.apply(item);
map.submitToKey(key, entryProcessor, callback);
return true;
} catch (HazelcastInstanceNotActiveException e) {
handleInstanceNotActive(instance, e, isLocal);
return false;
}
}
示例3: saveUpdatedAttributeFlushModeImmediate
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
@Test
public void saveUpdatedAttributeFlushModeImmediate() {
verify(this.sessions, times(1)).addEntryListener(any(MapListener.class),
anyBoolean());
this.repository.setHazelcastFlushMode(HazelcastFlushMode.IMMEDIATE);
HazelcastSession session = this.repository.createSession();
session.setAttribute("testName", "testValue");
verify(this.sessions, times(1)).set(eq(session.getId()),
eq(session.getDelegate()), isA(Long.class), eq(TimeUnit.SECONDS));
verify(this.sessions, times(1)).executeOnKey(eq(session.getId()),
any(EntryProcessor.class));
this.repository.save(session);
verifyZeroInteractions(this.sessions);
}
示例4: removeAttributeFlushModeImmediate
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
@Test
public void removeAttributeFlushModeImmediate() {
verify(this.sessions, times(1)).addEntryListener(any(MapListener.class),
anyBoolean());
this.repository.setHazelcastFlushMode(HazelcastFlushMode.IMMEDIATE);
HazelcastSession session = this.repository.createSession();
session.removeAttribute("testName");
verify(this.sessions, times(1)).set(eq(session.getId()),
eq(session.getDelegate()), isA(Long.class), eq(TimeUnit.SECONDS));
verify(this.sessions, times(1)).executeOnKey(eq(session.getId()),
any(EntryProcessor.class));
this.repository.save(session);
verifyZeroInteractions(this.sessions);
}
示例5: saveUpdatedLastAccessedTimeFlushModeImmediate
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
@Test
public void saveUpdatedLastAccessedTimeFlushModeImmediate() {
verify(this.sessions, times(1)).addEntryListener(any(MapListener.class),
anyBoolean());
this.repository.setHazelcastFlushMode(HazelcastFlushMode.IMMEDIATE);
HazelcastSession session = this.repository.createSession();
session.setLastAccessedTime(Instant.now());
verify(this.sessions, times(1)).set(eq(session.getId()),
eq(session.getDelegate()), isA(Long.class), eq(TimeUnit.SECONDS));
verify(this.sessions, times(1)).executeOnKey(eq(session.getId()),
any(EntryProcessor.class));
this.repository.save(session);
verifyZeroInteractions(this.sessions);
}
示例6: saveUpdatedMaxInactiveIntervalInSecondsFlushModeImmediate
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
@Test
public void saveUpdatedMaxInactiveIntervalInSecondsFlushModeImmediate() {
verify(this.sessions, times(1)).addEntryListener(any(MapListener.class),
anyBoolean());
this.repository.setHazelcastFlushMode(HazelcastFlushMode.IMMEDIATE);
HazelcastSession session = this.repository.createSession();
session.setMaxInactiveInterval(Duration.ofSeconds(1));
verify(this.sessions, times(1)).set(eq(session.getId()),
eq(session.getDelegate()), isA(Long.class), eq(TimeUnit.SECONDS));
verify(this.sessions, times(1)).executeOnKey(eq(session.getId()),
any(EntryProcessor.class));
this.repository.save(session);
verifyZeroInteractions(this.sessions);
}
示例7: executeOnKey
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
/**
* Execute on key.
*
* @param sessionId the session id
* @param processor the processor
* @return the object
* @throws Exception
*/
Object executeOnKey(String sessionId, EntryProcessor processor) throws Exception {
try {
return clusterMap.executeOnKey(sessionId, processor);
} catch (Exception e) {
LOGGER.finest("Cannot connect hazelcast server", e);
throw e;
}
}
示例8: executeOnKey
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @deprecated not implemented yet
* @throws UnsupportedOperationException not implemented yet
*/
@Deprecated
@SuppressWarnings("rawtypes")
@Override
public Object executeOnKey(K key, EntryProcessor entryProcessor) {
throw new UnsupportedOperationException();
}
示例9: executeOnKeys
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @deprecated not implemented yet
* @throws UnsupportedOperationException not implemented yet
*/
@Deprecated
@SuppressWarnings("rawtypes")
@Override
public Map<K, Object> executeOnKeys(Set<K> keys,
EntryProcessor entryProcessor) {
throw new UnsupportedOperationException();
}
示例10: submitToKey
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @deprecated not implemented yet
* @throws UnsupportedOperationException not implemented yet
*/
@Deprecated
@SuppressWarnings("rawtypes")
@Override
public void submitToKey(K key, EntryProcessor entryProcessor,
ExecutionCallback callback) {
throw new UnsupportedOperationException();
}
示例11: executeOnEntries
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @deprecated not implemented yet
* @throws UnsupportedOperationException not implemented yet
*/
@Deprecated
@SuppressWarnings("rawtypes")
@Override
public Map<K, Object> executeOnEntries(EntryProcessor entryProcessor) {
throw new UnsupportedOperationException();
}
示例12: remoteMapWithEntryProcessor
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
/**
* Returns a sink equivalent to {@link #mapWithEntryProcessor}, but for a map
* in a remote Hazelcast cluster identified by the supplied {@code
* ClientConfig}.
*/
public static <E, K, V> Sink<E> remoteMapWithEntryProcessor(
@Nonnull String mapName,
@Nonnull ClientConfig clientConfig,
@Nonnull DistributedFunction<E, K> toKeyFn,
@Nonnull DistributedFunction<E, EntryProcessor<K, V>> toEntryProcessorFn
) {
return fromProcessor("remoteMapWithEntryProcessorSink(" + mapName + ')',
updateRemoteMapP(mapName, clientConfig, toKeyFn, toEntryProcessorFn));
}
示例13: EntryProcessorWriter
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
private EntryProcessorWriter(HazelcastInstance instance, String name,
DistributedFunction toKeyFn,
DistributedFunction<T, EntryProcessor<K, V>> toEntryProcessorFn,
boolean isLocal) {
this.instance = instance;
this.map = instance.getMap(name);
this.toKeyFn = toKeyFn;
this.toEntryProcessorFn = toEntryProcessorFn;
this.isLocal = isLocal;
}
示例14: EntryProcessorWriterSupplier
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
private EntryProcessorWriterSupplier(String name, SerializableClientConfig clientConfig,
DistributedFunction<T, K> toKeyFn,
DistributedFunction<T, EntryProcessor<K, V>> toEntryProcessorFn,
boolean isLocal) {
this.name = name;
this.clientConfig = clientConfig;
this.toKeyFn = toKeyFn;
this.toEntryProcessorFn = toEntryProcessorFn;
this.isLocal = isLocal;
}
示例15: entryProcessor
import com.hazelcast.map.EntryProcessor; //导入依赖的package包/类
public static <K, V> EntryProcessor<K, V> entryProcessor(
DistributedBiFunction<? super K, ? super V, ? extends V> remappingFunction
) {
return new AbstractEntryProcessor<K, V>() {
@Override
public Object process(Entry<K, V> entry) {
V newValue = remappingFunction.apply(entry.getKey(), entry.getValue());
entry.setValue(newValue);
return newValue;
}
};
}