本文整理汇总了Java中com.hazelcast.core.EntryEvent类的典型用法代码示例。如果您正苦于以下问题:Java EntryEvent类的具体用法?Java EntryEvent怎么用?Java EntryEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntryEvent类属于com.hazelcast.core包,在下文中一共展示了EntryEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: theEntryAdded
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
private void theEntryAdded(EntryEvent<String, DeploymentManagement> entryEvent) {
DeploymentManagement deploymentManagement = entryEvent.getValue();
Validate.notNull(deploymentManagement, "deploymentManagement must not be null");
if (!deploymentManagement.getDeploymentDescription().
getLocationInCluster().equals(gatewayRulesService.fetchGatewayRules().getLocation())) {
if (LOG.isDebugEnabled()) LOG.debug("BeyondJManagementService ignoring incoming deploymentManagement " +
"since it references a service not in this instance. Current server is {} and target server is {}",
gatewayRulesService.fetchGatewayRules().getLocation(), deploymentManagement.getDeploymentDescription().
getLocationInCluster());
return;
//do nothing
}
try {
String supervisorId = deploymentManagement.getDeploymentDescription().getSupervisorId();
BeyondJRemotingService remotingService = new BeyondJRemotingService();
ActorRefService actorRefService = remotingService.getRemoteServiceProxy(ActorRefService.class, ACTOR_REF_SERVICE);
ActorRef deploymentSupervisor = actorRefService.getActorRefs().get(supervisorId);
deploymentSupervisor.tell(deploymentManagement, null);
} catch (Exception e) {
LOG.error("Error calling actor", e);
}
}
示例2: entryAdded
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryAdded(EntryEvent<Serializable, V> event) {
try
{
final Serializable t = intercept(event.getKey(), event.getValue(), event.getOldValue());
feederThreads.submit(new Runnable() {
@Override
public void run() {
outChannel.feed(t);
}
});
} catch (Exception e) {
log.error("Exception on message interception. Not fed to downstream", e);
}
}
示例3: entryUpdated
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryUpdated(EntryEvent<Serializable, V> event) {
try {
final Serializable t = intercept(event.getKey(), event.getValue(), event.getOldValue());
feederThreads.submit(new Runnable() {
@Override
public void run() {
outChannel.feed(t);
}
});
} catch (Exception e) {
log.error("Exception on message interception. Not fed to downstream", e);
}
}
示例4: entryAdded
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryAdded(EntryEvent<String, BpmEvent> event) {
BpmEvent bpmEvent = event.getValue();
logger.log(Level.INFO, "BpmEventListener.entryAdded executor {0}", new Object[]{bpmEvent.getExecutor()});
try {
BpmEvent.EXECUTOR executor = bpmEvent.getExecutor();
switch (executor) {
case ACTOR_RESOLVER:
InternalAPI.get().executeActorResolver(bpmEvent.getCaseId(), bpmEvent.getTaskId());
break;
case CONNECTOR:
InternalAPI.get().executeConnectorOut(bpmEvent.getCaseId(), bpmEvent.getTaskId());
break;
case JOIN:
InternalAPI.get().executeJoin(bpmEvent.getCaseId(), bpmEvent.getTaskId(), bpmEvent.getJoinId());
break;
case TRANSITION:
InternalAPI.get().executeTransition(bpmEvent.getCaseId(), bpmEvent.getTaskId());
break;
}
HazelcastServer.removeBpmEvent(bpmEvent);
} catch (Exception ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
}
示例5: entryUpdated
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryUpdated(EntryEvent<DeviceId, RoleValue> event) {
// compare old and current RoleValues. If master is different,
// emit MASTER_CHANGED. else, emit BACKUPS_CHANGED.
RoleValue oldValue = event.getOldValue();
RoleValue newValue = event.getValue();
// There will be no oldValue at the very first instance of an EntryEvent.
// Technically, the progression is: null event -> null master -> some master;
// We say a null master and a null oldValue are the same condition.
NodeId oldMaster = null;
if (oldValue != null) {
oldMaster = oldValue.get(MASTER);
}
NodeId newMaster = newValue.get(MASTER);
if (!Objects.equal(oldMaster, newMaster)) {
notifyDelegate(new MastershipEvent(
MASTER_CHANGED, event.getKey(), event.getValue().roleInfo()));
} else {
notifyDelegate(new MastershipEvent(
BACKUPS_CHANGED, event.getKey(), event.getValue().roleInfo()));
}
}
示例6: entryAdded
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryAdded(final EntryEvent<String, Object> ee)
{
log.info("Entry added for " + ee.getKey());
final List<DistributedPropertyChangedAction<?>> actions = propertyChangedActions.get(ee.getKey());
if (actions == null)
{
return;
}
ClusterThreadManager.get().enqueue(new Callable<Void>()
{
@SuppressWarnings(
{ "unchecked" })
@Override
public Void call() throws Exception
{
for (@SuppressWarnings("rawtypes")
DistributedPropertyChangedAction pca : actions)
{
pca.distributedPropertyDidChange(ee.getMember(), null, ee.getValue());
}
return null;
}
});
}
示例7: entryAdded
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryAdded(final EntryEvent<G, H> e)
{
ClusterThreadManager.get().enqueue(new Callable<Void>()
{
@Override
public Void call() throws Exception
{
for (ItemAddedAction<G, H> action : addedActions)
{
action.itemAddedToCollection(collection, e.getKey(), e.getValue(), e.getMember());
}
return null;
}
});
}
示例8: entryRemoved
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryRemoved(final EntryEvent<G, H> e)
{
ClusterThreadManager.get().enqueue(new Callable<Void>()
{
@Override
public Void call() throws Exception
{
for (ItemRemovedAction<G, H> action : removedActions)
{
action.itemRemovedFromCollection(collection, e.getKey(), e.getValue(), e.getMember());
}
return null;
}
});
}
示例9: entryUpdated
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryUpdated(final EntryEvent<G, H> e)
{
ClusterThreadManager.get().enqueue(new Callable<Void>()
{
@Override
public Void call() throws Exception
{
for (ItemUpdatedAction<G, H> action : updatedActions)
{
action.itemUpdatedInCollection(collection, e.getKey(), e.getOldValue(), e.getValue(), e.getMember());
}
return null;
}
});
}
示例10: simulateCacheInserts
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
private void simulateCacheInserts(Cache cache) {
EntryListener EntryListener = EntryListeners.get(cache);
if (EntryListener != null) {
if (cache instanceof CacheWrapper) {
Cache wrapped = ((CacheWrapper) cache).getWrappedCache();
if (wrapped instanceof ClusteredCache) {
ClusteredCache clusteredCache = (ClusteredCache) wrapped;
for (Map.Entry entry : (Set<Map.Entry>) cache.entrySet()) {
EntryEvent event = new EntryEvent(clusteredCache.map.getName(), cluster.getLocalMember(),
EntryEventType.ADDED.getType(), entry.getKey(), null, entry.getValue());
EntryListener.entryAdded(event);
}
}
}
}
}
示例11: handleEntryEvent
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
private void handleEntryEvent(EntryEvent event, boolean removal) {
NodeID nodeID = NodeID.getInstance(StringUtils.getBytes(event.getMember().getUuid()));
// ignore events which were triggered by this node
if (!XMPPServer.getInstance().getNodeID().equals(nodeID)) {
Set<DomainPair> sessionJIDS = nodeRoutes.get(nodeID);
if (sessionJIDS == null) {
sessionJIDS = new HashSet<>();
}
if (removal) {
sessionJIDS.remove(event.getKey());
}
else {
sessionJIDS.add((DomainPair)event.getKey());
}
}
}
示例12: HazelcastEventStore
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
public HazelcastEventStore(int maxLogSizePerAggregate, IMap<InstanceId, List<InstanceEvent>> eventLog) {
super(maxLogSizePerAggregate, eventLog);
eventLog.addEntryListener((MapListener) new EntryAdapter<InstanceId, List<InstanceEvent>>() {
@Override
public void entryUpdated(EntryEvent<InstanceId, List<InstanceEvent>> event) {
log.debug("Updated {}", event);
long lastKnownVersion = getLastVersion(event.getOldValue());
List<InstanceEvent> newEvents = event.getValue()
.stream()
.filter(e -> e.getVersion() > lastKnownVersion)
.collect(Collectors.toList());
HazelcastEventStore.this.publish(newEvents);
}
}, true);
}
示例13: entryAdded
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
public void entryAdded(EntryEvent event) {
byte[] nodeID = StringUtils.getBytes(event.getMember().getUuid());
// Ignore events originated from this JVM
if (!XMPPServer.getInstance().getNodeID().equals(nodeID)) {
// Check if the directed presence was sent to an entity hosted by this JVM
RoutingTable routingTable = XMPPServer.getInstance().getRoutingTable();
String sender = event.getKey().toString();
Collection<String> handlers = new HashSet<String>();
for (JID handler : getHandlers(event)) {
if (routingTable.isLocalRoute(handler)) {
// Keep track of the remote sender and local handler that got the directed presence
handlers.addAll(getReceivers(event, handler));
}
}
if (!handlers.isEmpty()) {
Map<String, Collection<String>> senders = nodePresences.get(NodeID.getInstance(nodeID));
if (senders == null) {
senders = new ConcurrentHashMap<String, Collection<String>>();
nodePresences.put(NodeID.getInstance(nodeID), senders);
}
senders.put(sender, handlers);
}
}
}
示例14: entryRemoved
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryRemoved(EntryEvent<String, byte[]> event) {
final Object value = KryoFactory.deserialize(event.getValue());
if (value instanceof Flow) {
// Handles events from flowMap.
final Flow flow = (Flow) value;
log.trace("Flow {} was removed", flow);
for (FlowMapEventListener e : listeners) {
e.flowRemoved(flow.getId());
}
} else if (value instanceof FlowState) {
// Handles events from flowStateMap.
log.trace("FlowState {} of FlowId {} was removed", value, event.getKey());
} else {
throw new IllegalStateException("Removed illegal value: " + value.toString());
}
}
示例15: entryUpdated
import com.hazelcast.core.EntryEvent; //导入依赖的package包/类
@Override
public void entryUpdated(EntryEvent<String, byte[]> event) {
final Object value = KryoFactory.deserialize(event.getValue());
if (value instanceof Flow) {
// Handles events from flowMap.
log.trace("Flow Updated by {}", value);
} else if (value instanceof FlowState) {
// Handles events from flowStateMap.
Object oldValue = KryoFactory.deserialize(event.getOldValue());
final FlowState state = (FlowState) value;
final FlowState oldState = (FlowState) oldValue;
final FlowId id = FlowId.valueOf(event.getKey());
log.trace("FlowState of FlowId {} was updated from {} to {}",
id, oldState, state);
for (FlowMapEventListener e : listeners) {
e.flowStateChanged(id, oldState, state);
}
} else {
throw new IllegalStateException("Updated illegal value: " + value.toString());
}
}