Example #1
0
  protected void doStopDispatch(DispatcherState curState) {
    boolean debugEnabled = _log.isDebugEnabled();
    if (debugEnabled) _log.debug("Entered stopConsumption");

    if (null != curState.getEventsIterator()) {
      curState.getEventsIterator().close();
    }
    if (null != curState.getLastSuccessfulIterator()) {
      curState.getLastSuccessfulIterator().close();
    }

    ConsumerCallbackResult stopSuccess = ConsumerCallbackResult.ERROR;
    try {
      stopSuccess = _asyncCallback.onStopConsumption();
    } catch (RuntimeException e) {
      DbusPrettyLogUtils.logExceptionAtError("Internal stopConsumption error", e, _log);
    }
    if (ConsumerCallbackResult.SUCCESS == stopSuccess
        || ConsumerCallbackResult.CHECKPOINT == stopSuccess) {
      if (debugEnabled) _log.debug("stopConsumption succeeded.");
    } else {

      getStatus().suspendOnError(new RuntimeException("Stop dispatcher failed"));
      _log.error("stopConsumption failed.");
    }
    getStatus().suspendOnError(new RuntimeException("Processing of events stopped"));
    _stopDispatch.set(true);
    if ((_serverHandle != null) && _serverHandle.isClusterEnabled()) {
      _log.error("Suspend while in clusterMode: shutting down");
      _serverHandle.shutdownAsynchronously();
      return;
    }
  }
Example #2
0
 protected void handleErrStoringSharedCheckpoint() {
   if (_serverHandle != null) {
     _log.info("Server should be shutdown! \n");
     // asynch shutdown; server is waiting on condition signalled by shutdown
     _serverHandle.shutdownAsynchronously();
   }
 }
Example #3
0
 protected void updateDSCTimestamp(long timestampInMillis) {
   if ((_serverHandle != null) && (_serverHandle.getDSCUpdater() != null)) {
     DatabusClientDSCUpdater updater = _serverHandle.getDSCUpdater();
     updater.writeTimestamp(timestampInMillis);
   }
 }