use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class ProxyRegistry method publish.
private void publish(DistributedObjectEventPacket event) {
EventService eventService = proxyService.nodeEngine.getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(ProxyServiceImpl.SERVICE_NAME, ProxyServiceImpl.SERVICE_NAME);
eventService.publishRemoteEvent(ProxyServiceImpl.SERVICE_NAME, registrations, event, event.getName().hashCode());
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class TopicService method publishMessage.
public void publishMessage(String topicName, Object payload, boolean multithreaded) {
Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, topicName);
if (!registrations.isEmpty()) {
Data payloadData = nodeEngine.toData(payload);
TopicEvent topicEvent = new TopicEvent(topicName, payloadData, localAddress);
int partitionId = multithreaded ? counter.incrementAndGet() : topicName.hashCode();
eventService.publishEvent(SERVICE_NAME, registrations, topicEvent, partitionId);
}
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class PublishOperation method run.
@Override
public void run() throws Exception {
TopicService service = getService();
TopicEvent topicEvent = new TopicEvent(name, message, getCallerAddress());
EventService eventService = getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(TopicService.SERVICE_NAME, name);
Lock lock = service.getOrderLock(name);
lock.lock();
try {
eventService.publishEvent(TopicService.SERVICE_NAME, registrations, topicEvent, name.hashCode());
} finally {
lock.unlock();
}
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class ClientMigrationListenerTest method assertRegistrationsSizeEventually.
private void assertRegistrationsSizeEventually(HazelcastInstance instance, int size) {
assertTrueEventually(() -> {
EventService eventService = getNode(instance).getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, MIGRATION_EVENT_TOPIC);
assertEquals(size, registrations.size());
});
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class ClientPartitionLostListenerTest method assertRegistrationsSizeEventually.
private void assertRegistrationsSizeEventually(final HazelcastInstance instance, final int size) {
assertTrueEventually(() -> {
final EventService eventService = getNode(instance).getNodeEngine().getEventService();
final Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, PARTITION_LOST_EVENT_TOPIC);
assertEquals(size, registrations.size());
});
}
Aggregations