コード例 #1
0
  @Override
  protected void ensureNodeServant() {
    if (servantUri != null) {
      return;
    }

    String node = getNameSupport().getNodeMessageAddress().getAddress();
    if (!establishConnections(node)) {
      releaseNodeServant();
      return;
    }

    try {
      servantUri = makeURI(node);
      setNodeURI(servantUri);
    } catch (URISyntaxException e) {
      loggingService.error("Failed to make URI for node " + node, e);
      releaseNodeServant();
      return;
    }

    // start polling for input
    if (receiver == null) {
      receiver = makeMessageReceiver();
    }

    Runnable task = makePollerTask();
    if (task != null) {
      int lane = ThreadService.WILL_BLOCK_LANE;
      poller = threadService.getThread(this, task, "Message Poller", lane);
      poller.schedule(0, 1);
    }
  }
コード例 #2
0
 @Override
 protected void releaseNodeServant() {
   servantUri = null;
   setNodeURI(null);
   if (poller != null) {
     poller.cancelTimer();
     poller = null;
   }
 }