@Override public void onMessage(final Message<Date> m) { StripedRunnable task = new StripedRunnable() { @Override public int getKey() { return topicName.hashCode(); } @Override public void run() { System.out.println("Received: " + m.getMessageObject()); } }; EXECUTOR.execute(task); } }
public void handleClientMessage(ClientMessage clientMessage) { try { eventExecutor.execute(new ClientEventProcessor(clientMessage)); } catch (RejectedExecutionException e) { logger.warning("Event clientMessage could not be handled", e); } }
public void handleClientMessage(ClientMessage clientMessage) { try { eventExecutor.execute(new ClientEventProcessor(clientMessage)); } catch (RejectedExecutionException e) { logger.warning("Event clientMessage could not be handled", e); } }
/** * {@inheritDoc} * If the execution is rejected, the rejection count is increased and a failure is logged. * The event callback is not re-executed. * * @param callback the callback to execute on a random event thread */ @Override public void executeEventCallback(Runnable callback) { if (!nodeEngine.isRunning()) { return; } try { eventExecutor.execute(callback); } catch (RejectedExecutionException e) { rejectedCount.inc(); if (eventExecutor.isLive()) { logFailure("EventQueue overloaded! Failed to execute event callback: %s", callback); } } }
/** * {@inheritDoc} * If the execution is rejected, the rejection count is increased and a failure is logged. * The event callback is not re-executed. * * @param callback the callback to execute on a random event thread */ @Override public void executeEventCallback(Runnable callback) { if (!nodeEngine.isRunning()) { return; } try { eventExecutor.execute(callback); } catch (RejectedExecutionException e) { rejectedCount.inc(); if (eventExecutor.isLive()) { logFailure("EventQueue overloaded! Failed to execute event callback: %s", callback); } } }
/** * {@inheritDoc} * Handles an asynchronous remote event with a {@link RemoteEventProcessor}. The * processor may determine the thread which will handle the event. If the execution is rejected, * the rejection count is increased and a failure is logged. The event processing is not retried. * * @param packet the response packet to handle * @see #sendEvent(Address, EventEnvelope, int) */ @Override public void accept(Packet packet) { try { eventExecutor.execute(new RemoteEventProcessor(this, packet)); } catch (RejectedExecutionException e) { rejectedCount.inc(); if (eventExecutor.isLive()) { Connection conn = packet.getConn(); String endpoint = conn.getEndPoint() != null ? conn.getEndPoint().toString() : conn.toString(); logFailure("EventQueue overloaded! Failed to process event packet sent from: %s", endpoint); } } }
/** * {@inheritDoc} * Handles an asynchronous remote event with a {@link RemoteEventProcessor}. The * processor may determine the thread which will handle the event. If the execution is rejected, * the rejection count is increased and a failure is logged. The event processing is not retried. * * @param packet the response packet to handle * @see #sendEvent(Address, EventEnvelope, int) */ @Override public void accept(Packet packet) { try { eventExecutor.execute(new RemoteEventProcessor(this, packet)); } catch (RejectedExecutionException e) { rejectedCount.inc(); if (eventExecutor.isLive()) { Connection conn = packet.getConn(); String endpoint = conn.getEndPoint() != null ? conn.getEndPoint().toString() : conn.toString(); logFailure("EventQueue overloaded! Failed to process event packet sent from: %s", endpoint); } } }
@Override public void publish(String mapName, String cacheId, Object event, int orderKey, Extractors extractors) { checkHasText(mapName, "mapName"); checkHasText(cacheId, "cacheId"); checkNotNull(event, "event cannot be null"); Collection<ListenerInfo> listeners = getListeners(mapName, cacheId); for (ListenerInfo info : listeners) { if (!canPassFilter(event, info.getFilter(), extractors)) { continue; } try { executor.execute(new EventDispatcher(event, info, orderKey, serializationService, EVENT_QUEUE_TIMEOUT_MILLIS)); } catch (RejectedExecutionException e) { // TODO Should we notify user when we overloaded? logger.warning("EventQueue overloaded! Can not process IMap=[" + mapName + "]" + ", QueryCache=[ " + cacheId + "]" + ", Event=[" + event + "]"); } } }
@Override public void publish(String mapName, String cacheId, Object event, int orderKey, Extractors extractors) { checkHasText(mapName, "mapName"); checkHasText(cacheId, "cacheId"); checkNotNull(event, "event cannot be null"); Collection<ListenerInfo> listeners = getListeners(mapName, cacheId); for (ListenerInfo info : listeners) { if (!canPassFilter(event, info.getFilter(), extractors)) { continue; } try { executor.execute(new EventDispatcher(event, info, orderKey, serializationService, EVENT_QUEUE_TIMEOUT_MILLIS)); } catch (RejectedExecutionException e) { // TODO Should we notify user when we overloaded? logger.warning("EventQueue overloaded! Can not process IMap=[" + mapName + "]" + ", QueryCache=[ " + cacheId + "]" + ", Event=[" + event + "]"); } } }
try { if (reg.getListener() != null) { eventExecutor.execute(new LocalEventDispatcher(this, serviceName, event, reg.getListener() , orderKey, eventQueueTimeoutMs)); } else {
try { if (reg.getListener() != null) { eventExecutor.execute(new LocalEventDispatcher(this, serviceName, event, reg.getListener() , orderKey, eventQueueTimeoutMs)); } else {