コード例 #1
0
 @Override
 public final void flush() {
   AMQPConnection<?> connection = _target.getSessionModel().getAMQPConnection();
   try {
     connection.alwaysAllowMessageAssignmentInThisThreadIfItIsIOThread(true);
     _queue.flushConsumer(this);
     _target.processPending();
   } finally {
     connection.alwaysAllowMessageAssignmentInThisThreadIfItIsIOThread(false);
   }
 }
コード例 #2
0
 @Override
 protected void onClose() {
   if (_closed.compareAndSet(false, true)) {
     _target.getSendLock();
     try {
       _waitingOnCreditMessageListener.remove();
       _target.consumerRemoved(this);
       _target.removeStateChangeListener(_listener);
       _queue.unregisterConsumer(this);
       deleted();
     } finally {
       _target.releaseSendLock();
     }
   }
 }
コード例 #3
0
  QueueConsumerImpl(
      final AbstractQueue<?> queue,
      ConsumerTarget target,
      final String consumerName,
      final FilterManager filters,
      final Class<? extends ServerMessage> messageClass,
      EnumSet<Option> optionSet) {
    super(
        parentsMap(queue, target.getSessionModel().getModelObject()),
        createAttributeMap(consumerName, filters, optionSet));
    _messageClass = messageClass;
    _sessionReference = target.getSessionModel().getConnectionReference();
    _consumerNumber = CONSUMER_NUMBER_GENERATOR.getAndIncrement();
    _filters = filters;
    _acquires = optionSet.contains(Option.ACQUIRES);
    _seesRequeues = optionSet.contains(Option.SEES_REQUEUES);
    _isTransient = optionSet.contains(Option.TRANSIENT);
    _target = target;
    _queue = queue;

    // Access control
    authoriseCreate(this);

    open();

    setupLogging();

    _listener =
        new StateChangeListener<ConsumerTarget, ConsumerTarget.State>() {
          @Override
          public void stateChanged(
              final ConsumerTarget object,
              final ConsumerTarget.State oldState,
              final ConsumerTarget.State newState) {
            targetStateChanged(oldState, newState);
          }
        };
    _target.addStateListener(_listener);

    _suspendedConsumerLoggingTicker =
        new SuspendedConsumerLoggingTicker(
            queue.getContextValue(Long.class, Consumer.SUSPEND_NOTIFICATION_PERIOD)) {
          @Override
          protected void log(final long period) {
            getEventLogger().message(getLogSubject(), SubscriptionMessages.STATE(period));
          }
        };
  }
コード例 #4
0
 public boolean resend(final QueueEntry entry) {
   boolean messageWasResent = getQueue().resend(entry, this);
   if (messageWasResent) {
     _target.processPending();
   }
   return messageWasResent;
 }
コード例 #5
0
 @Override
 public void acquisitionRemoved(final QueueEntry node) {
   _target.acquisitionRemoved(node);
   _queue.decrementUnackedMsgCount(node);
 }
コード例 #6
0
 public final void send(final QueueEntry entry, final boolean batch) {
   _deliveredCount.incrementAndGet();
   long size = _target.send(this, entry, batch);
   _deliveredBytes.addAndGet(size);
 }
コード例 #7
0
 @Override
 public State getState() {
   return STATE_MAP.get(_target.getState());
 }
コード例 #8
0
 public void queueEmpty() {
   _target.queueEmpty();
 }
コード例 #9
0
 public void restoreCredit(final QueueEntry queueEntry) {
   _target.restoreCredit(queueEntry.getMessage());
 }
コード例 #10
0
 public boolean wouldSuspend(final QueueEntry msg) {
   return !_target.allocateCredit(msg.getMessage());
 }
コード例 #11
0
 public void queueDeleted() {
   _target.queueDeleted();
 }
コード例 #12
0
 public void flushBatched() {
   _target.flushBatched();
 }
コード例 #13
0
 @Override
 public boolean isSuspended() {
   return _target.isSuspended();
 }
コード例 #14
0
 @Override
 public AMQSessionModel getSessionModel() {
   return _target.getSessionModel();
 }
コード例 #15
0
 @Override
 public long getUnacknowledgedMessages() {
   return _target.getUnacknowledgedMessages();
 }