public InterruptableSubscriber(
     Consumer<? super T> consumer,
     Consumer<? super Throwable> errorConsumer,
     Consumer<Void> completeConsumer) {
   super(consumer, errorConsumer, completeConsumer);
   SUBSCRIPTION.lazySet(this, UNSUBSCRIBED);
 }
 /** get returns the last value lazySet by same thread */
 public void testGetLazySet() {
   AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer> a;
   try {
     a =
         AtomicReferenceFieldUpdater.newUpdater(
             AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
   } catch (RuntimeException ok) {
     return;
   }
   x = one;
   assertSame(one, a.get(this));
   a.lazySet(this, two);
   assertSame(two, a.get(this));
   a.lazySet(this, m3);
   assertSame(m3, a.get(this));
 }
    boolean checkTerminated(boolean d, boolean empty, Subscriber<? super T> a) {
      if (cancelled) {
        VALUE.lazySet(this, null);
        return true;
      }

      if (d) {
        Throwable e = error;
        if (e != null) {
          VALUE.lazySet(this, null);

          a.onError(e);
          return true;
        } else if (empty) {
          a.onComplete();
          return true;
        }
      }

      return false;
    }
    @Override
    public void cancel() {
      if (!cancelled) {

        cancelled = true;

        s.cancel();

        if (WIP.getAndIncrement(this) == 0) {
          VALUE.lazySet(this, null);
        }
      }
    }
 @Override
 public void onNext(T t) {
   VALUE.lazySet(this, t);
   drain();
 }
Ejemplo n.º 6
0
 Item(final K key, final int hashCode, final V value) {
   this.key = key;
   this.hashCode = hashCode;
   //noinspection ThisEscapedInObjectConstruction
   valueUpdater.lazySet(this, value);
 }
Ejemplo n.º 7
0
 void init(Subscriber<? super Object> s) {
   actual = s;
   CANCEL.lazySet(this, this);
   wip = 0;
 }
Ejemplo n.º 8
0
 public InboundSink(io.netty.channel.Channel channel) {
   this.ch = channel;
   CANCEL.lazySet(this, this);
 }