void soConsumerIndex(long newIndex) { consumerIndex.lazySet(newIndex); }
void soProducerIndex(long newIndex) { producerIndex.lazySet(newIndex); }
private void soProducerIndex(long v) { producerIndex.lazySet(v); }
private void soConsumerIndex(long v) { consumerIndex.lazySet(v); }
void soConsumerIndex(long newIndex) { consumerIndex.lazySet(newIndex); }
void soProducerIndex(long newIndex) { producerIndex.lazySet(newIndex); }
private void soProducerIndex(long v) { producerIndex.lazySet(v); }
private void soConsumerIndex(long v) { consumerIndex.lazySet(v); }
public void set(final long value) { this.value.lazySet(value); }
static void lazySet(AtomicLong al, long i) { if (al instanceof BTraceAtomicLong) { al.lazySet(i); } else { throw new IllegalArgumentException(); } }
WindowBoundaryMainObserver(Observer<? super Observable<T>> actual, ObservableSource<B> open, Function<? super B, ? extends ObservableSource<V>> close, int bufferSize) { super(actual, new MpscLinkedQueue<Object>()); this.open = open; this.close = close; this.bufferSize = bufferSize; this.resources = new CompositeDisposable(); this.ws = new ArrayList<UnicastSubject<T>>(); windows.lazySet(1); }
WindowBoundaryMainSubscriber(Subscriber<? super Flowable<T>> actual, Publisher<B> open, Function<? super B, ? extends Publisher<V>> close, int bufferSize) { super(actual, new MpscLinkedQueue<Object>()); this.open = open; this.close = close; this.bufferSize = bufferSize; this.resources = new CompositeDisposable(); this.ws = new ArrayList<UnicastProcessor<T>>(); windows.lazySet(1); }
WindowBoundaryMainSubscriber(Subscriber<? super Flowable<T>> actual, Publisher<B> open, Function<? super B, ? extends Publisher<V>> close, int bufferSize) { super(actual, new MpscLinkedQueue<Object>()); this.open = open; this.close = close; this.bufferSize = bufferSize; this.resources = new CompositeDisposable(); this.ws = new ArrayList<UnicastProcessor<T>>(); windows.lazySet(1); }
WindowBoundaryMainObserver(Observer<? super Observable<T>> actual, ObservableSource<B> open, Function<? super B, ? extends ObservableSource<V>> close, int bufferSize) { super(actual, new MpscLinkedQueue<Object>()); this.open = open; this.close = close; this.bufferSize = bufferSize; this.resources = new CompositeDisposable(); this.ws = new ArrayList<UnicastSubject<T>>(); windows.lazySet(1); }
@Override public int offer(E e) { final long writeCount = writeCounter.get(); final int index = (int) (writeCount & BUFFER_MASK); AtomicReference<Object> slot = buffer[index]; Object value = slot.get(); if (!(value instanceof Turn)) { // Either full or lost due to contention - try to drain return FULL; } else if (((Turn) value).id != writeCount) { // Ensures CAS reference equality, race should rarely occur return FAILED; } // Try to record, but we don't care if we win or lose if (slot.compareAndSet(value, e)) { writeCounter.lazySet(writeCount + 1); return SUCCESS; } return FAILED; }
@Override public void onNext(T t) { if (t == null) { throw new NullPointerException("t == null"); } long pi = producerIndex.get(); queue.lazySet((int)pi & BUFFER_MASK, t); producerIndex.lazySet(pi + 1); drain(); }
oo.requested.lazySet(1); oo.queue = new SimpleQueue<Integer>() {
oo.requested.lazySet(1); oo.queue = new SimpleQueue<Integer>() {
oo.requested.lazySet(1); oo.queue = new SimpleQueue<Integer>() {
oo.requested.lazySet(1); oo.queue = new SimpleQueue<Integer>() {