/* Use this version for fire and forget style messaging. */ public void sendOneWay(Message message, EndPoint to) { // do local deliveries if (message.getFrom().equals(to)) { MessagingService.receive(message); return; } Runnable tcpWriteEvent = new MessageSerializationTask(message, to); messageSerializerExecutor_.execute(tcpWriteEvent); }
private static void enqueueRunnable(String stageName, Runnable runnable) { IStage stage = StageManager.getStage(stageName); if (stage != null) { logger_.info("Running on stage " + stage.getName()); stage.execute(runnable); } else { logger_.info("Running on default stage - beware"); messageSerializerExecutor_.execute(runnable); } }
public void stream(String file, long startPosition, long total, EndPoint from, EndPoint to) { isStreaming_.set(true); /* Streaming asynchronously on streamExector_ threads. */ Runnable streamingTask = new FileStreamTask(file, startPosition, total, from, to); streamExecutor_.execute(streamingTask); }