Example #1
0
  @Override
  public void reconnect() {

    markAsDown(null);
    reconnect(cpDown);

    if (cpState.get() == cpActive) {
      monitor.hostUp(host, this);
    }
  }
Example #2
0
  @Override
  public void markAsDown(DynoException reason) {
    if (Logger.isDebugEnabled()) {
      Logger.debug(String.format("Marking Host Connection Pool %s DOWN", getHost()));
    }

    ConnectionPoolState<CL> currentState = cpState.get();

    if (currentState == cpDown) {
      if (Logger.isDebugEnabled()) {
        Logger.debug("CP is already down, hence ignoring mark as down request");
      }
      return;
    }

    if (!(cpState.compareAndSet(currentState, cpDown))) {
      // someone already beat us to it
      return;
    }

    monitor.hostDown(host, reason);
    monitor.resetConnectionBorrowedLatStats(); // NOTE - SIDE EFFECT
  }