本文整理汇总了Java中io.reactivex.internal.util.OpenHashSet类的典型用法代码示例。如果您正苦于以下问题:Java OpenHashSet类的具体用法?Java OpenHashSet怎么用?Java OpenHashSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpenHashSet类属于io.reactivex.internal.util包,在下文中一共展示了OpenHashSet类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispose
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
@Override
public void dispose() {
if (!disposed) {
OpenHashSet<Disposable> set;
synchronized (this) {
if (disposed) {
return;
}
set = tasks;
tasks = null;
disposed = true;
}
Object[] keys = set.keys();
for (Object o : keys) {
if (o instanceof Disposable) {
((Disposable) o).dispose();
}
}
}
}
示例2: add
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
public boolean add(Subscription s) {
if (!cancelled) {
synchronized (this) {
if (!cancelled) {
OpenHashSet<Subscription> h = set;
if (h == null) {
h = new OpenHashSet<Subscription>();
set = h;
}
h.add(s);
return true;
}
}
}
s.cancel();
return false;
}
示例3: cancel
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
@Override
public void cancel() {
if (!cancelled) {
OpenHashSet<Subscription> h;
synchronized (this) {
if (cancelled) {
return;
}
h = set;
set = null;
cancelled = true;
}
if (h != null) {
Object[] array = h.keys();
for (Object o : array) {
if (o != null) {
((Subscription)o).cancel();
}
}
}
}
}
示例4: dispose
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
@Override
public void dispose() {
if (!disposed) {
OpenHashSet<WorkerTask> set;
synchronized (this) {
if (disposed) {
return;
}
disposed = true;
set = tasks;
tasks = null;
}
Object[] o = set.keys();
for (Object e : o) {
if (e instanceof WorkerTask) {
WorkerTask wt = (WorkerTask) e;
wt.dispose();
}
}
}
}
示例5: delete
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
public void delete(Subscription s) {
if (!cancelled) {
synchronized (this) {
if (!cancelled) {
OpenHashSet<Subscription> h = set;
if (h != null) {
h.remove(s);
}
}
}
}
}
示例6: add
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
boolean add(WorkerTask task) {
synchronized (this) {
OpenHashSet<WorkerTask> set = tasks;
if (set != null) {
set.add(task);
return true;
}
}
return false;
}
示例7: delete
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
void delete(WorkerTask task) {
synchronized (this) {
OpenHashSet<WorkerTask> set = tasks;
if (set != null) {
set.remove(task);
}
}
}
示例8: AsyncSwingWorker
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
AsyncSwingWorker() {
this.tasks = new OpenHashSet<Disposable>();
}
示例9: SingleResourceWorker
import io.reactivex.internal.util.OpenHashSet; //导入依赖的package包/类
SingleResourceWorker() {
this.tasks = new OpenHashSet<>();
}