コード例 #1
0
ファイル: Node.java プロジェクト: loganfreeman/undertow
  void healthCheckPing(final long threshold, NodeHealthChecker healthChecker) {
    int oldState, newState;
    for (; ; ) {
      oldState = this.state;
      if ((oldState & ACTIVE_PING) != 0) {
        // There is already a ping active
        return;
      }
      newState = oldState | ACTIVE_PING;
      if (stateUpdater.compareAndSet(this, oldState, newState)) {
        break;
      }
    }

    NodePingUtil.internalPingNode(
        this,
        new NodePingUtil.PingCallback() {
          @Override
          public void completed() {
            clearActivePing();
          }

          @Override
          public void failed() {
            if (healthCheckFailed() == threshold) {
              // Remove using the executor task pool
              ioThread
                  .getWorker()
                  .execute(
                      new Runnable() {
                        @Override
                        public void run() {
                          container.removeNode(Node.this, true);
                          clearActivePing();
                        }
                      });
            } else {
              clearActivePing();
            }
          }
        },
        healthChecker,
        ioThread,
        bufferPool,
        container.getClient(),
        container.getXnioSsl(),
        OptionMap.EMPTY);
  }
コード例 #2
0
ファイル: Node.java プロジェクト: loganfreeman/undertow
 protected Node(
     NodeConfig nodeConfig,
     Balancer balancerConfig,
     XnioIoThread ioThread,
     ByteBufferPool bufferPool,
     ModClusterContainer container) {
   this.id = idGen.incrementAndGet();
   this.jvmRoute = nodeConfig.getJvmRoute();
   this.nodeConfig = nodeConfig;
   this.ioThread = ioThread;
   this.bufferPool = bufferPool;
   this.balancerConfig = balancerConfig;
   this.container = container;
   this.connectionPoolManager = new NodeConnectionPoolManager();
   this.connectionPool =
       new ProxyConnectionPool(
           connectionPoolManager,
           nodeConfig.getConnectionURI(),
           container.getXnioSsl(),
           container.getClient(),
           container.getClientOptions());
 }