java.util.concurrent.atomic.AtomicReference.lazySet()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中java.util.concurrent.atomic.AtomicReference.lazySet()方法的一些代码示例,展示了AtomicReference.lazySet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AtomicReference.lazySet()方法的具体详情如下:
包路径:java.util.concurrent.atomic.AtomicReference
类名称:AtomicReference
方法名:lazySet

AtomicReference.lazySet介绍

[英]Eventually sets to the given value.
[中]最终设置为给定值。

代码示例

代码示例来源:origin: ReactiveX/RxJava

@Override
void onUnsubscribed() {
  if (wip.getAndIncrement() == 0) {
    queue.lazySet(null);
  }
}

代码示例来源:origin: ReactiveX/RxJava

MergeSubscriber(Subscriber<? super U> actual, Function<? super T, ? extends Publisher<? extends U>> mapper,
    boolean delayErrors, int maxConcurrency, int bufferSize) {
  this.downstream = actual;
  this.mapper = mapper;
  this.delayErrors = delayErrors;
  this.maxConcurrency = maxConcurrency;
  this.bufferSize = bufferSize;
  this.scalarLimit = Math.max(1, maxConcurrency >> 1);
  subscribers.lazySet(EMPTY);
}

代码示例来源:origin: ReactiveX/RxJava

void setCurrent(Object o) {
  writeLock.lock();
  index++;
  value.lazySet(o);
  writeLock.unlock();
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onNext(T t) {
  current.lazySet(t);
  drain();
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onComplete() {
  current.lazySet(NotificationLite.COMPLETE);
  drain();
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onSuccess(T value) {
  current.lazySet(value);
  drain();
}

代码示例来源:origin: ReactiveX/RxJava

/**
 * Constructs a BehaviorSubject with the given initial value.
 * @param defaultValue the initial value, not null (verified)
 * @throws NullPointerException if {@code defaultValue} is null
 * @since 2.0
 */
BehaviorSubject(T defaultValue) {
  this();
  this.value.lazySet(ObjectHelper.requireNonNull(defaultValue, "defaultValue is null"));
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onComplete() {
  current.lazySet(NotificationLite.COMPLETE);
  drain();
}

代码示例来源:origin: ReactiveX/RxJava

/**
 * Constructs a BehaviorProcessor with the given initial value.
 * @param defaultValue the initial value, not null (verified)
 * @throws NullPointerException if {@code defaultValue} is null
 * @since 2.0
 */
BehaviorProcessor(T defaultValue) {
  this();
  this.value.lazySet(ObjectHelper.requireNonNull(defaultValue, "defaultValue is null"));
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onSuccess(T value) {
  current.lazySet(value);
  drain();
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onComplete() {
  current.lazySet(NotificationLite.COMPLETE);
  drain();
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onSuccess(T value) {
  current.lazySet(value);
  drain();
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void subscribe(Subscriber<? super T> s) {
  if (once.compareAndSet(false, true)) {
    s.onSubscribe(this);
    actual.lazySet(s);
    drain();
  } else {
    EmptySubscription.error(new IllegalStateException("Only one Subscriber allowed!"), s);
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void dispose() {
  cancelled = true;
  upstream.dispose();
  worker.dispose();
  if (getAndIncrement() == 0) {
    latest.lazySet(null);
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void dispose() {
  if (cancelled.compareAndSet(false, true)) {
    if (getAndIncrement() == 0) {
      actual.lazySet(null);
      parent.cancel(key);
    }
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void cancel() {
  if (!cancelled) {
    cancelled = true;
    upstream.cancel();
    if (getAndIncrement() == 0) {
      current.lazySet(null);
    }
  }
}

代码示例来源:origin: ReactiveX/RxJava

void errorOrComplete(Observer<? super T> a) {
  downstream.lazySet(null);
  Throwable ex = error;
  if (ex != null) {
    a.onError(ex);
  } else {
    a.onComplete();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onError(Throwable e) {
  current.lazySet(NotificationLite.COMPLETE);
  if (errors.addThrowable(e)) {
    drain();
  } else {
    RxJavaPlugins.onError(e);
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onError(Throwable t) {
  upstream.lazySet(SubscriptionHelper.CANCELLED);
  actual.onError(t);
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void cancel() {
  cancelled = true;
  upstream.cancel();
  worker.dispose();
  if (getAndIncrement() == 0) {
    latest.lazySet(null);
  }
}

相关文章