Esempio n. 1
0
 @Override
 public void subscribe(final Subscriber<? super QueueSignal> subscriber) {
   try {
     if (refCount.getAndIncrement() == 0) {
       this.channel = lapin.createChannel();
     }
     subscriber.onSubscribe(createSubscription(subscriber, null, null));
   } catch (Exception e) {
     refCount.incrementAndGet();
     subscriber.onError(e);
   }
 }
Esempio n. 2
0
  @Override
  public boolean cancelSubscription(PushSubscription<QueueSignal> petitMessagePushSubscription) {
    if (this.channel != null) {
      try {
        if (refCount.decrementAndGet() == 0) {
          lapin.destroyChannel(channel);
        }
      } catch (IOException e) {

        return false;
      }
    }
    return true;
  }