本文整理了Java中java.util.concurrent.atomic.AtomicInteger.lazySet()
方法的一些代码示例,展示了AtomicInteger.lazySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AtomicInteger.lazySet()
方法的具体详情如下:
包路径:java.util.concurrent.atomic.AtomicInteger
类名称:AtomicInteger
方法名:lazySet
[英]Eventually sets to the given value.
[中]最终设置为给定值。
代码示例来源:origin: ReactiveX/RxJava
@Override
public void cancel() {
if (winner.get() != -1) {
winner.lazySet(-1);
for (AmbInnerSubscriber<T> a : subscribers) {
a.cancel();
}
}
}
}
代码示例来源:origin: ReactiveX/RxJava
void setupSubscribers() {
Subscriber<? super T>[] subs = subscribers;
final int m = subs.length;
for (int i = 0; i < m; i++) {
if (cancelled) {
return;
}
subscriberCount.lazySet(i + 1);
subs[i].onSubscribe(new RailSubscription(i, m));
}
}
代码示例来源:origin: ReactiveX/RxJava
JoinSubscriptionBase(Subscriber<? super T> actual, int n, int prefetch) {
this.downstream = actual;
@SuppressWarnings("unchecked")
JoinInnerSubscriber<T>[] a = new JoinInnerSubscriber[n];
for (int i = 0; i < n; i++) {
a[i] = new JoinInnerSubscriber<T>(this, prefetch);
}
this.subscribers = a;
done.lazySet(n);
}
代码示例来源:origin: ReactiveX/RxJava
ParallelReduceFullMainSubscriber(Subscriber<? super T> subscriber, int n, BiFunction<T, T, T> reducer) {
super(subscriber);
@SuppressWarnings("unchecked")
ParallelReduceFullInnerSubscriber<T>[] a = new ParallelReduceFullInnerSubscriber[n];
for (int i = 0; i < n; i++) {
a[i] = new ParallelReduceFullInnerSubscriber<T>(this, reducer);
}
this.subscribers = a;
this.reducer = reducer;
remaining.lazySet(n);
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void dispose() {
if (winner.get() != -1) {
winner.lazySet(-1);
for (AmbInnerObserver<T> a : observers) {
a.dispose();
}
}
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
SortedJoinSubscription(Subscriber<? super T> actual, int n, Comparator<? super T> comparator) {
this.downstream = actual;
this.comparator = comparator;
SortedJoinInnerSubscriber<T>[] s = new SortedJoinInnerSubscriber[n];
for (int i = 0; i < n; i++) {
s[i] = new SortedJoinInnerSubscriber<T>(this, i);
}
this.subscribers = s;
this.lists = new List[n];
this.indexes = new int[n];
remaining.lazySet(n);
}
代码示例来源:origin: btraceio/btrace
static void lazySet(AtomicInteger ai, int i) {
if (ai instanceof BTraceAtomicInteger) {
ai.lazySet(i);
} else {
throw new IllegalArgumentException();
}
}
代码示例来源:origin: redisson/redisson
@Override
public void cancel() {
if (winner.get() != -1) {
winner.lazySet(-1);
for (AmbInnerSubscriber<T> a : subscribers) {
a.cancel();
}
}
}
}
代码示例来源:origin: ReactiveX/RxJava
public void subscribe(Publisher<? extends T>[] sources) {
AmbInnerSubscriber<T>[] as = subscribers;
int len = as.length;
for (int i = 0; i < len; i++) {
as[i] = new AmbInnerSubscriber<T>(this, i + 1, downstream);
}
winner.lazySet(0); // release the contents of 'as'
downstream.onSubscribe(this);
for (int i = 0; i < len; i++) {
if (winner.get() != 0) {
return;
}
sources[i].subscribe(as[i]);
}
}
代码示例来源:origin: redisson/redisson
JoinSubscriptionBase(Subscriber<? super T> actual, int n, int prefetch) {
this.actual = actual;
@SuppressWarnings("unchecked")
JoinInnerSubscriber<T>[] a = new JoinInnerSubscriber[n];
for (int i = 0; i < n; i++) {
a[i] = new JoinInnerSubscriber<T>(this, prefetch);
}
this.subscribers = a;
done.lazySet(n);
}
代码示例来源:origin: redisson/redisson
@Override
public void dispose() {
if (winner.get() != -1) {
winner.lazySet(-1);
for (AmbInnerObserver<T> a : observers) {
a.dispose();
}
}
}
代码示例来源:origin: redisson/redisson
void setupSubscribers() {
Subscriber<? super T>[] subs = subscribers;
final int m = subs.length;
for (int i = 0; i < m; i++) {
if (cancelled) {
return;
}
subscriberCount.lazySet(i + 1);
subs[i].onSubscribe(new RailSubscription(i, m));
}
}
代码示例来源:origin: redisson/redisson
ParallelReduceFullMainSubscriber(Subscriber<? super T> subscriber, int n, BiFunction<T, T, T> reducer) {
super(subscriber);
@SuppressWarnings("unchecked")
ParallelReduceFullInnerSubscriber<T>[] a = new ParallelReduceFullInnerSubscriber[n];
for (int i = 0; i < n; i++) {
a[i] = new ParallelReduceFullInnerSubscriber<T>(this, reducer);
}
this.subscribers = a;
this.reducer = reducer;
remaining.lazySet(n);
}
代码示例来源:origin: redisson/redisson
@SuppressWarnings("unchecked")
SortedJoinSubscription(Subscriber<? super T> actual, int n, Comparator<? super T> comparator) {
this.actual = actual;
this.comparator = comparator;
SortedJoinInnerSubscriber<T>[] s = new SortedJoinInnerSubscriber[n];
for (int i = 0; i < n; i++) {
s[i] = new SortedJoinInnerSubscriber<T>(this, i);
}
this.subscribers = s;
this.lists = new List[n];
this.indexes = new int[n];
remaining.lazySet(n);
}
代码示例来源:origin: apache/ignite
/**
* @param tbl Table.
*/
private void incrementKeys(AtomicLongArray tbl) {
locKeys.lazySet(locKeys.get() + 1);
if (rnd.nextInt(tbl.length()) < 512)
rehashIfNeeded(tbl);
}
代码示例来源:origin: ReactiveX/RxJava
public void subscribe(ObservableSource<? extends T>[] sources) {
AmbInnerObserver<T>[] as = observers;
int len = as.length;
for (int i = 0; i < len; i++) {
as[i] = new AmbInnerObserver<T>(this, i + 1, downstream);
}
winner.lazySet(0); // release the contents of 'as'
downstream.onSubscribe(this);
for (int i = 0; i < len; i++) {
if (winner.get() != 0) {
return;
}
sources[i].subscribe(as[i]);
}
}
代码示例来源:origin: redisson/redisson
public void subscribe(Publisher<? extends T>[] sources) {
AmbInnerSubscriber<T>[] as = subscribers;
int len = as.length;
for (int i = 0; i < len; i++) {
as[i] = new AmbInnerSubscriber<T>(this, i + 1, actual);
}
winner.lazySet(0); // release the contents of 'as'
actual.onSubscribe(this);
for (int i = 0; i < len; i++) {
if (winner.get() != 0) {
return;
}
sources[i].subscribe(as[i]);
}
}
代码示例来源:origin: org.apache.lucene/lucene-core
/**
* Invalidates this guard and unmaps (if supported).
*/
public void invalidateAndUnmap(ByteBuffer... bufs) throws IOException {
if (cleaner != null) {
invalidated = true;
// This call should hopefully flush any CPU caches and as a result make
// the "invalidated" field update visible to other threads. We specifically
// don't make "invalidated" field volatile for performance reasons, hoping the
// JVM won't optimize away reads of that field and hardware should ensure
// caches are in sync after this call. This isn't entirely "fool-proof"
// (see LUCENE-7409 discussion), but it has been shown to work in practice
// and we count on this behavior.
barrier.lazySet(0);
// we give other threads a bit of time to finish reads on their ByteBuffer...:
Thread.yield();
// finally unmap the ByteBuffers:
for (ByteBuffer b : bufs) {
cleaner.freeBuffer(resourceDescription, b);
}
}
}
代码示例来源:origin: redisson/redisson
public void subscribe(ObservableSource<? extends T>[] sources) {
AmbInnerObserver<T>[] as = observers;
int len = as.length;
for (int i = 0; i < len; i++) {
as[i] = new AmbInnerObserver<T>(this, i + 1, actual);
}
winner.lazySet(0); // release the contents of 'as'
actual.onSubscribe(this);
for (int i = 0; i < len; i++) {
if (winner.get() != 0) {
return;
}
sources[i].subscribe(as[i]);
}
}
代码示例来源:origin: seven332/EhViewer
mDownloadedPages.lazySet(0);
mFinishedPages.lazySet(0);
mPageErrorMap.clear();
mPagePercentMap.clear();
内容来源于网络,如有侵权,请联系作者删除!