com.hazelcast.core.EntryEvent Java Examples
The following examples show how to use
com.hazelcast.core.EntryEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HazelcastEventStore.java From Moss with Apache License 2.0 | 6 votes |
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); }
Example #2
Source File: HazelcastMapConsumerIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("unchecked") public void testRemove() throws Exception { CamelContext camelctx = createCamelContext(); camelctx.start(); try { MockEndpoint mock = camelctx.getEndpoint("mock:removed", MockEndpoint.class); mock.expectedMessageCount(1); EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.REMOVED.getType(), "4711", "my-foo"); argument.getValue().entryRemoved(event); mock.assertIsSatisfied(3000); checkHeaders(mock.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.REMOVED); } finally { camelctx.close(); } }
Example #3
Source File: HazelcastMapConsumerIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("unchecked") public void testUpdate() throws Exception { CamelContext camelctx = createCamelContext(); camelctx.start(); try { MockEndpoint mock = camelctx.getEndpoint("mock:updated", MockEndpoint.class); mock.expectedMessageCount(1); EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.UPDATED.getType(), "4711", "my-foo"); argument.getValue().entryUpdated(event); mock.assertIsSatisfied(3000); checkHeaders(mock.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.UPDATED); } finally { camelctx.close(); } }
Example #4
Source File: HazelcastMapConsumerIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("unchecked") public void testEvict() throws Exception { CamelContext camelctx = createCamelContext(); camelctx.start(); try { MockEndpoint mock = camelctx.getEndpoint("mock:evicted", MockEndpoint.class); mock.expectedMessageCount(1); EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.EVICTED.getType(), "4711", "my-foo"); argument.getValue().entryEvicted(event); mock.assertIsSatisfied(3000); } finally { camelctx.close(); } }
Example #5
Source File: HazelcastMapConsumerIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("unchecked") public void testAdd() throws Exception { CamelContext camelctx = createCamelContext(); camelctx.start(); try { MockEndpoint mock = camelctx.getEndpoint("mock:added", MockEndpoint.class); mock.expectedMessageCount(1); EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.ADDED.getType(), "4711", "my-foo"); argument.getValue().entryAdded(event); mock.assertIsSatisfied(3000); checkHeaders(mock.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.ADDED); } finally { camelctx.close(); } }
Example #6
Source File: ClientManager.java From openmeetings with Apache License 2.0 | 6 votes |
void init() { log.debug("Cluster:: PostConstruct"); onlineClients.putAll(map()); onlineRooms.putAll(rooms()); onlineServers.putAll(servers()); map().addEntryListener(new ClientListener(), true); rooms().addEntryListener(new RoomListener(), true); servers().addEntryListener(new EntryUpdatedListener<String, ServerInfo>() { @Override public void entryUpdated(EntryEvent<String, ServerInfo> event) { log.debug("Cluster:: Server was updated {} -> {}", event.getKey(), event.getValue()); onlineServers.put(event.getKey(), event.getValue()); } }, true); }
Example #7
Source File: PricePanelListener.java From hazelcast-jet-demos with Apache License 2.0 | 6 votes |
/** * <p>An event is produced each time a price is written * into an {@link com.hazelcast.core.IMap IMap}. For each * of these, add it to the graph, so producing a plot of * the changes to the map. * </p> * * @param entryEvent Produced by Jet writing into an IMap */ public void handle(EntryEvent<String, Price> entryEvent) { // Initialise the panel on first use synchronized (this) { if (pricePanel == null) { this.activateDisplay(); } } // Extract the fields, and simplify the rate for plotting String priceKey = entryEvent.getKey(); LocalDate day = entryEvent.getValue().getLocalDate(); double rate = entryEvent.getValue().getRate().doubleValue(); // Add this price to the chart pricePanel.update(priceKey, day, rate); }
Example #8
Source File: OperationExpirationListener.java From eventapis with Apache License 2.0 | 6 votes |
@Override public void entryExpired(EntryEvent<String, Topology> event) { event.getKey(); Topology topology = event.getOldValue(); try { topology.getProducedEvents().forEach(this::setLeafs); } catch (Exception ex) { log.warn("Error while trying to check Leafs:" + ex.getMessage()); } if (!topology.isFinished()) { log.warn("Topology Doesn't Finished:" + topology.toString()); operationsHistoryMap.putIfAbsent(event.getKey(), event.getOldValue(), 1, TimeUnit.DAYS); } else { log.info("Topology OK:" + topology.toString()); operationsHistoryMap.putIfAbsent(event.getKey(), event.getOldValue(), 1, TimeUnit.HOURS); } }
Example #9
Source File: ClusteredConcurrentIndexedCollection.java From GreenSummer with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void entryAdded(EntryEvent<K, O> event) { if (isRemoteEvent(event)) { log.trace("Entry Added: {}", event); ClusteredConcurrentIndexedCollection.this.notifyAddition(event.getValue()); ClusteredConcurrentIndexedCollection.super.add(event.getValue()); } }
Example #10
Source File: SubsMapHelper.java From vertx-hazelcast with Apache License 2.0 | 5 votes |
private void fireRegistrationUpdateEvent(EntryEvent<String, HazelcastRegistrationInfo> event) { String address = event.getKey(); vertx.<List<RegistrationInfo>>executeBlocking(prom -> { prom.complete(get(address)); }, false, ar -> { if (ar.succeeded()) { nodeSelector.registrationsUpdated(new RegistrationUpdateEvent(address, ar.result())); } else { log.trace("A failure occured while retrieving the updated registrations", ar.cause()); nodeSelector.registrationsUpdated(new RegistrationUpdateEvent(address, Collections.emptyList())); } }); }
Example #11
Source File: HazelcastEventStore.java From spring-boot-admin with Apache License 2.0 | 5 votes |
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); }
Example #12
Source File: HazelcastIndexedSessionRepository.java From spring-session with Apache License 2.0 | 5 votes |
@Override public void entryRemoved(EntryEvent<String, MapSession> event) { MapSession session = event.getOldValue(); if (session != null) { if (logger.isDebugEnabled()) { logger.debug("Session deleted with id: " + session.getId()); } this.eventPublisher.publishEvent(new SessionDeletedEvent(this, session)); } }
Example #13
Source File: HazelcastIndexedSessionRepository.java From spring-session with Apache License 2.0 | 5 votes |
@Override public void entryEvicted(EntryEvent<String, MapSession> event) { if (logger.isDebugEnabled()) { logger.debug("Session expired with id: " + event.getOldValue().getId()); } this.eventPublisher.publishEvent(new SessionExpiredEvent(this, event.getOldValue())); }
Example #14
Source File: HazelcastIndexedSessionRepository.java From spring-session with Apache License 2.0 | 5 votes |
@Override public void entryAdded(EntryEvent<String, MapSession> event) { MapSession session = event.getValue(); if (session.getId().equals(session.getOriginalId())) { if (logger.isDebugEnabled()) { logger.debug("Session created with id: " + session.getId()); } this.eventPublisher.publishEvent(new SessionCreatedEvent(this, session)); } }
Example #15
Source File: ClientManager.java From openmeetings with Apache License 2.0 | 5 votes |
private void process(EntryEvent<String, Client> event, boolean shouldAdd) { if (event.getMember().localMember()) { return; } final String uid = event.getKey(); synchronized (onlineClients) { if (onlineClients.containsKey(uid)) { onlineClients.get(uid).merge(event.getValue()); } else if (shouldAdd) { onlineClients.put(uid, event.getValue()); } } }
Example #16
Source File: CommandListener.java From hazelcast-jet-demos with Apache License 2.0 | 5 votes |
private void handle(EntryEvent<String, List<String>> arg0) throws Exception { log.info("'{}' '{}'", arg0.getKey(), arg0.getValue()); String noun = arg0.getKey(); List<String> params = arg0.getValue(); String verb = params.get(0); if (verb.equalsIgnoreCase(Constants.COMMAND_VERB_START)) { this.handleStart(noun, (params.size() == 1 ? null : params.get(1))); } else { log.error("Unknown command verb '{}'", verb); } }
Example #17
Source File: ClusteredConcurrentIndexedCollection.java From GreenSummer with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void entryRemoved(EntryEvent<K, O> event) { if (isRemoteEvent(event)) { log.trace("Entry Removed: {}", event); ClusteredConcurrentIndexedCollection.this.notifyRemoval(event.getOldValue()); ClusteredConcurrentIndexedCollection.super.remove(event.getOldValue()); } }
Example #18
Source File: ClusteredConcurrentIndexedCollection.java From GreenSummer with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void entryUpdated(EntryEvent<K, O> event) { if (isRemoteEvent(event)) { log.trace("Entry Updated: {}", event); ClusteredConcurrentIndexedCollection.this.notifyRemoval(event.getOldValue()); ClusteredConcurrentIndexedCollection.super.remove(event.getOldValue()); ClusteredConcurrentIndexedCollection.this.notifyAddition(event.getValue()); ClusteredConcurrentIndexedCollection.super.add(event.getValue()); } }
Example #19
Source File: ClusteredConcurrentIndexedCollection.java From GreenSummer with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void entryEvicted(EntryEvent<K, O> event) { if (isRemoteEvent(event)) { log.trace("Entry Evicted: {}", event); ClusteredConcurrentIndexedCollection.this.notifyRemoval(event.getValue()); ClusteredConcurrentIndexedCollection.super.remove(event.getValue()); } }
Example #20
Source File: LoggingListener.java From hazelcast-jet-demos with Apache License 2.0 | 5 votes |
private void log(EntryEvent entryEvent) { log.info("{} event, map '{}', key '{}', new value '{}'", entryEvent.getEventType(), entryEvent.getName(), entryEvent.getKey(), entryEvent.getValue()); }
Example #21
Source File: CommandListener.java From hazelcast-jet-demos with Apache License 2.0 | 5 votes |
@Override public void entryUpdated(EntryEvent<String, List<String>> arg0) { try { this.handle(arg0); } catch (Exception e) { log.error("entryUpdated", e); } }
Example #22
Source File: CommandListener.java From hazelcast-jet-demos with Apache License 2.0 | 5 votes |
@Override public void entryAdded(EntryEvent<String, List<String>> arg0) { try { this.handle(arg0); } catch (Exception e) { log.error("entryAdded", e); } }
Example #23
Source File: CryptoSentimentGui.java From hazelcast-jet-demos with Apache License 2.0 | 5 votes |
private void onMapEvent(EntryEvent<Tuple2<CoinType, WinSize>, Tuple2<Double, Long>> event) { EventQueue.invokeLater(() -> { CoinType coinType = event.getKey().f0(); WinSize winSize = event.getKey().f1(); Tuple2<Double, Long> metrics = event.getValue(); double sentimentScore = metrics.f0(); double mentionsPerMinute = metrics.f1() / ((double) winSize.durationMillis() / MINUTES.toMillis(1)); sentimentDataset.addValue(sentimentScore, coinType, winSize); mentionsDataset.addValue(mentionsPerMinute, coinType, winSize); frame.repaint(); }); }
Example #24
Source File: EntryListenerImpl.java From hazelcast-simulator with Apache License 2.0 | 4 votes |
@Override public void entryAdded(EntryEvent<K, V> objectObjectEntryEvent) { delay(); addCount.incrementAndGet(); }
Example #25
Source File: ListenerExample.java From hazelcast-demo with Apache License 2.0 | 4 votes |
@Override public void entryUpdated(EntryEvent<Integer, String> entry) {//监听更新数据 print("put entry. key = " + entry.getKey() + ". value = " + entry.getValue()); }
Example #26
Source File: MyListener.java From chuidiang-ejemplos with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void entryUpdated(EntryEvent<String, Object> event) { System.out.println("Updated: "+event.getKey()+" = "+event.getValue()); }
Example #27
Source File: SubsMapHelper.java From vertx-hazelcast with Apache License 2.0 | 4 votes |
@Override public void entryAdded(EntryEvent<String, HazelcastRegistrationInfo> event) { fireRegistrationUpdateEvent(event); }
Example #28
Source File: LoggingListener.java From hazelcast-jet-demos with Apache License 2.0 | 4 votes |
@Override public void entryAdded(EntryEvent arg0) { this.log(arg0); }
Example #29
Source File: SubsMapHelper.java From vertx-hazelcast with Apache License 2.0 | 4 votes |
@Override public void entryEvicted(EntryEvent<String, HazelcastRegistrationInfo> event) { }
Example #30
Source File: SubsMapHelper.java From vertx-hazelcast with Apache License 2.0 | 4 votes |
@Override public void entryRemoved(EntryEvent<String, HazelcastRegistrationInfo> event) { fireRegistrationUpdateEvent(event); }