Ejemplo n.º 1
0
  private void targetStateChanged(
      final ConsumerTarget.State oldState, final ConsumerTarget.State newState) {
    if (oldState != newState) {
      if (newState == ConsumerTarget.State.CLOSED) {
        if (_targetClosed.compareAndSet(false, true)) {
          getEventLogger().message(getLogSubject(), SubscriptionMessages.CLOSE());
        }
      }

      if (newState == ConsumerTarget.State.SUSPENDED) {
        _suspendedConsumerLoggingTicker.setStartTime(System.currentTimeMillis());
        getSessionModel().addTicker(_suspendedConsumerLoggingTicker);
      } else {
        getSessionModel().removeTicker(_suspendedConsumerLoggingTicker);
      }
    }

    if (newState == ConsumerTarget.State.CLOSED && oldState != newState && !_closed.get()) {
      closeAsync();
    }
    final StateChangeListener<? super QueueConsumerImpl, State> stateListener = getStateListener();
    if (stateListener != null) {
      stateListener.stateChanged(this, STATE_MAP.get(oldState), STATE_MAP.get(newState));
    }
  }
Ejemplo n.º 2
0
 private void setupLogging() {
   final String filterLogString = getFilterLogString();
   getEventLogger()
       .message(
           this,
           SubscriptionMessages.CREATE(
               filterLogString, _queue.isDurable() && _exclusive, filterLogString.length() > 0));
 }