예제 #1
0
  private void resetState(String state, long transitionTime) {
    if (isConnected()) {
      totalTimeConnected += (System.currentTimeMillis() - this.transitionTime);
    }

    this.state = state;
    this.transitionTime = transitionTime;
  }
예제 #2
0
  void clientLeaseRenewed(long lastLeaseRenewalTime, long lease) {
    this.numLeaseRenewals++;
    this.lease = lease;
    this.lastLeaseRenewalTime = System.currentTimeMillis();

    if (!isConnected()) {
      resetState(CONNECTED, lastLeaseRenewalTime);
    }
  }
예제 #3
0
  public void clientConnectionEstablished(long lease) {
    transitionTime = System.currentTimeMillis();

    if (deltaMetrics == null) {
      createDeltaMetric();
    }

    deltaMetrics.clientConnectionEstablished(transitionTime, lease);
    cumulativeMetrics.clientConnectionEstablished(transitionTime, lease);
  }
예제 #4
0
  public void clientConnectionRefused() {
    transitionTime = System.currentTimeMillis();

    if (deltaMetrics == null) {
      createDeltaMetric();
    }

    deltaMetrics.clientConnectionRefused(transitionTime);
    cumulativeMetrics.clientConnectionRefused(transitionTime);
  }
예제 #5
0
  public void clientConnectionDisconnected(boolean normal) {
    transitionTime = System.currentTimeMillis();

    if (deltaMetrics == null) {
      createDeltaMetric();
    }

    deltaMetrics.clientConnectionDisconnected(normal, transitionTime);
    cumulativeMetrics.clientConnectionDisconnected(normal, transitionTime);
  }
예제 #6
0
  public void clientLeaseRenewed(long lease) {
    lastLeaseRenewalTime = System.currentTimeMillis();

    if (deltaMetrics == null) {
      createDeltaMetric();
    }

    deltaMetrics.clientLeaseRenewed(lastLeaseRenewalTime, lease);
    cumulativeMetrics.clientLeaseRenewed(lastLeaseRenewalTime, lease);
  }
예제 #7
0
 /**
  * Get the duration of current connection relative to local clock (from transition time) <br>
  * <br>
  * <B>Note:</B> This assumes the clocks are in sync with the reporting peer
  *
  * @see #getTotalTimeConnected(long)
  * @return time in ms (see note above) or 0 if not connected
  */
 public long getTimeConnected() {
   return getTimeConnected(System.currentTimeMillis());
 }