/** * Creates an {@code AtomicReferenceArray} instance with the same length as, and all elements * copied from, the given array. * * @param array the array to copy elements from * @return a new {@code AtomicReferenceArray} copied from the given array */ public static <E> AtomicReferenceArray<E> newReferenceArray(E[] array) { return new AtomicReferenceArray<E>(array); } }
/** * Creates an {@code AtomicReferenceArray} instance of given length. * * @param length the length of the array * @return a new {@code AtomicReferenceArray} with the given length */ public static <E> AtomicReferenceArray<E> newReferenceArray(int length) { return new AtomicReferenceArray<E>(length); }
SmallLazyStriped(int stripes, Supplier<L> supplier) { super(stripes); this.size = (mask == ALL_SET) ? Integer.MAX_VALUE : mask + 1; this.locks = new AtomicReferenceArray<>(size); this.supplier = supplier; }
AtomicReferenceArray<ReferenceEntry<K, V>> newEntryArray(int size) { return new AtomicReferenceArray<>(size); }
AtomicReferenceArray<E> newEntryArray(int size) { return new AtomicReferenceArray<E>(size); }
public AtomicQueue (int capacity) { queue = new AtomicReferenceArray(capacity); }
public AtomicQueue (int capacity) { queue = new AtomicReferenceArray(capacity); }
/** * Creates an {@code AtomicReferenceArray} instance with the same length as, and all elements * copied from, the given array. * * @param array the array to copy elements from * @return a new {@code AtomicReferenceArray} copied from the given array */ public static <E> AtomicReferenceArray<E> newReferenceArray(E[] array) { return new AtomicReferenceArray<E>(array); } }
SmallLazyStriped(int stripes, Supplier<L> supplier) { super(stripes); this.size = (mask == ALL_SET) ? Integer.MAX_VALUE : mask + 1; this.locks = new AtomicReferenceArray<>(size); this.supplier = supplier; }
/** * Creates an {@code AtomicReferenceArray} instance of given length. * * @param length the length of the array * @return a new {@code AtomicReferenceArray} with the given length */ public static <E> AtomicReferenceArray<E> newReferenceArray(int length) { return new AtomicReferenceArray<E>(length); }
AtomicReferenceArray<ReferenceEntry<K, V>> newEntryArray(int size) { return new AtomicReferenceArray<>(size); }
AtomicReferenceArray<E> newEntryArray(int size) { return new AtomicReferenceArray<E>(size); }
WithLatestFromSubscriber(Subscriber<? super R> actual, Function<? super Object[], R> combiner, int n) { this.downstream = actual; this.combiner = combiner; WithLatestInnerSubscriber[] s = new WithLatestInnerSubscriber[n]; for (int i = 0; i < n; i++) { s[i] = new WithLatestInnerSubscriber(this, i); } this.subscribers = s; this.values = new AtomicReferenceArray<Object>(n); this.upstream = new AtomicReference<Subscription>(); this.requested = new AtomicLong(); this.error = new AtomicThrowable(); }
WithLatestFromObserver(Observer<? super R> actual, Function<? super Object[], R> combiner, int n) { this.downstream = actual; this.combiner = combiner; WithLatestInnerObserver[] s = new WithLatestInnerObserver[n]; for (int i = 0; i < n; i++) { s[i] = new WithLatestInnerObserver(this, i); } this.observers = s; this.values = new AtomicReferenceArray<Object>(n); this.upstream = new AtomicReference<Disposable>(); this.error = new AtomicThrowable(); }
public SpscLinkedArrayQueue(final int bufferSize) { int p2capacity = Pow2.roundToPowerOfTwo(Math.max(8, bufferSize)); int mask = p2capacity - 1; AtomicReferenceArray<Object> buffer = new AtomicReferenceArray<Object>(p2capacity + 1); producerBuffer = buffer; producerMask = mask; adjustLookAheadStep(p2capacity); consumerBuffer = buffer; consumerMask = mask; producerLookAhead = mask - 1; // we know it's all empty to start with soProducerIndex(0L); }
WithLatestFromSubscriber(Subscriber<? super R> actual, Function<? super Object[], R> combiner, int n) { this.actual = actual; this.combiner = combiner; WithLatestInnerSubscriber[] s = new WithLatestInnerSubscriber[n]; for (int i = 0; i < n; i++) { s[i] = new WithLatestInnerSubscriber(this, i); } this.subscribers = s; this.values = new AtomicReferenceArray<Object>(n); this.s = new AtomicReference<Subscription>(); this.requested = new AtomicLong(); this.error = new AtomicThrowable(); }
WithLatestFromObserver(Observer<? super R> actual, Function<? super Object[], R> combiner, int n) { this.actual = actual; this.combiner = combiner; WithLatestInnerObserver[] s = new WithLatestInnerObserver[n]; for (int i = 0; i < n; i++) { s[i] = new WithLatestInnerObserver(this, i); } this.observers = s; this.values = new AtomicReferenceArray<Object>(n); this.d = new AtomicReference<Disposable>(); this.error = new AtomicThrowable(); }
private void resize(final AtomicReferenceArray<Object> oldBuffer, final long currIndex, final int offset, final T e, final long mask) { final int capacity = oldBuffer.length(); final AtomicReferenceArray<Object> newBuffer = new AtomicReferenceArray<Object>(capacity); producerBuffer = newBuffer; producerLookAhead = currIndex + mask - 1; soElement(newBuffer, offset, e); // StoreStore soNext(oldBuffer, newBuffer); soElement(oldBuffer, offset, HAS_NEXT); // new buffer is visible after element is // inserted soProducerIndex(currIndex + 1); // this ensures correctness on 32bit platforms }
public SpscLinkedArrayQueue(final int bufferSize) { int p2capacity = Pow2.roundToPowerOfTwo(Math.max(8, bufferSize)); int mask = p2capacity - 1; AtomicReferenceArray<Object> buffer = new AtomicReferenceArray<Object>(p2capacity + 1); producerBuffer = buffer; producerMask = mask; adjustLookAheadStep(p2capacity); consumerBuffer = buffer; consumerMask = mask; producerLookAhead = mask - 1; // we know it's all empty to start with soProducerIndex(0L); }
private void resize(final AtomicReferenceArray<Object> oldBuffer, final long currIndex, final int offset, final T e, final long mask) { final int capacity = oldBuffer.length(); final AtomicReferenceArray<Object> newBuffer = new AtomicReferenceArray<Object>(capacity); producerBuffer = newBuffer; producerLookAhead = currIndex + mask - 1; soElement(newBuffer, offset, e);// StoreStore soNext(oldBuffer, newBuffer); soElement(oldBuffer, offset, HAS_NEXT); // new buffer is visible after element is // inserted soProducerIndex(currIndex + 1);// this ensures correctness on 32bit platforms }