コード例 #1
0
  public void logErrorInCheckStatusResponse(
      ClientSubscriptionChannel channel,
      CheckStatusResponseStructure response,
      boolean isNewer,
      boolean isInError) {

    StringBuilder b = new StringBuilder();
    b.append("check status failed for channel:");
    b.append(" address=").append(channel.getAddress());

    if (isNewer) {
      b.append(" prevServiceStartedTime=");
      b.append(channel.getLastServiceStartedTime());
      b.append(" newServiceStartedTime=");
      b.append(response.getServiceStartedTime());
    }

    ErrorCondition error = response.getErrorCondition();
    if (isInError && error != null) {
      ClientSupport.appendError(error.getServiceNotAvailableError(), b);
      ClientSupport.appendError(error.getOtherError(), b);
      if (error.getDescription() != null && error.getDescription().getValue() != null)
        b.append(" errorDescription=" + error.getDescription().getValue());
    }

    _log.warn(b.toString());
  }
コード例 #2
0
  private boolean isCheckStatusNewer(
      ClientSubscriptionChannel channel, CheckStatusResponseStructure response) {

    Date serviceStartedTime = response.getServiceStartedTime();

    if (serviceStartedTime == null) return false;

    /** Has the service start time been adjusted since our last status check? */
    Date lastServiceStartedTime = channel.getLastServiceStartedTime();

    if (lastServiceStartedTime == null) {
      channel.setLastServiceStartedTime(serviceStartedTime);
    } else if (serviceStartedTime.after(lastServiceStartedTime)) {
      return true;
    }

    return false;
  }