예제 #1
0
  /*
      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);
  }
예제 #2
0
  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);
    }
  }
예제 #3
0
 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);
 }