distributeReplicationMessage(message, false);
}
}
void distributeReplicationMessage(final Object message, final boolean forceSend) {
final PreReplicationHook preReplicationHook = getPreReplicationHook();
if (forceSend || preReplicationHook == null) {
Collection<EventRegistration> eventRegistrations = eventService.getRegistrations(SERVICE_NAME, EVENT_TOPIC_NAME);
Collection<EventRegistration> registrations = filterEventRegistrations(eventRegistrations);
eventService.publishEvent(ReplicatedMapService.SERVICE_NAME, registrations, message, name.hashCode());
} else {
executionService.execute(EXECUTOR_NAME, new Runnable() {
@Override
public void run() {
if (message instanceof MultiReplicationMessage) {
preReplicationHook.preReplicateMultiMessage((MultiReplicationMessage) message, ReplicationPublisher.this);
} else {
preReplicationHook.preReplicateMessage((ReplicationMessage) message, ReplicationPublisher.this);
}
}
});
}
}