コード例 #1
0
 public InterruptableSubscriber(
     Consumer<? super T> consumer,
     Consumer<? super Throwable> errorConsumer,
     Consumer<Void> completeConsumer) {
   super(consumer, errorConsumer, completeConsumer);
   SUBSCRIPTION.lazySet(this, UNSUBSCRIBED);
 }
コード例 #2
0
 /** 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));
 }
コード例 #3
0
    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;
    }
コード例 #4
0
    @Override
    public void cancel() {
      if (!cancelled) {

        cancelled = true;

        s.cancel();

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