本文整理汇总了Java中rx.functions.Action0.call方法的典型用法代码示例。如果您正苦于以下问题:Java Action0.call方法的具体用法?Java Action0.call怎么用?Java Action0.call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.functions.Action0
的用法示例。
在下文中一共展示了Action0.call方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureETagExceptionIsThrown
import rx.functions.Action0; //导入方法依赖的package包/类
/**
* Runs the action and assert that action throws CloudException with CloudError.Code
* property set to 'PreconditionFailed'.
*
* @param action action to run
*/
private void ensureETagExceptionIsThrown(final Action0 action) {
boolean isCloudExceptionThrown = false;
boolean isCloudErrorSet = false;
boolean isPreconditionFailedCodeSet = false;
try {
action.call();
} catch (CloudException exception) {
isCloudExceptionThrown = true;
CloudError cloudError = exception.body();
if (cloudError != null) {
isCloudErrorSet = true;
isPreconditionFailedCodeSet = cloudError.code().contains("PreconditionFailed");
}
}
Assert.assertTrue("Expected CloudException is not thrown", isCloudExceptionThrown);
Assert.assertTrue("Expected CloudError property is not set in CloudException", isCloudErrorSet);
Assert.assertTrue("Expected PreconditionFailed code is not set indicating ETag concurrency check failure", isPreconditionFailedCodeSet);
}
示例2: schedulePeriodically
import rx.functions.Action0; //导入方法依赖的package包/类
public Subscription schedulePeriodically(Action0 action, long initialDelay, long period, TimeUnit unit) {
final long periodInNanos = unit.toNanos(period);
final long startInNanos = TimeUnit.MILLISECONDS.toNanos(now()) + unit.toNanos(initialDelay);
final MultipleAssignmentSubscription mas = new MultipleAssignmentSubscription();
final Action0 action0 = action;
Action0 recursiveAction = new Action0() {
long count = 0;
public void call() {
if (!mas.isUnsubscribed()) {
action0.call();
long j = startInNanos;
long j2 = this.count + 1;
this.count = j2;
mas.set(Worker.this.schedule(this, (j + (j2 * periodInNanos)) - TimeUnit.MILLISECONDS.toNanos(Worker.this.now()), TimeUnit.NANOSECONDS));
}
}
};
MultipleAssignmentSubscription s = new MultipleAssignmentSubscription();
mas.set(s);
s.set(schedule(recursiveAction, initialDelay, unit));
return mas;
}
示例3: create
import rx.functions.Action0; //导入方法依赖的package包/类
public static final <T> Observer<T> create(final Action1<? super T> onNext, final Action1<Throwable> onError, final Action0 onComplete) {
if (onNext == null) {
throw new IllegalArgumentException("onNext can not be null");
} else if (onError == null) {
throw new IllegalArgumentException("onError can not be null");
} else if (onComplete != null) {
return new Observer<T>() {
public final void onCompleted() {
onComplete.call();
}
public final void onError(Throwable e) {
onError.call(e);
}
public final void onNext(T args) {
onNext.call(args);
}
};
} else {
throw new IllegalArgumentException("onComplete can not be null");
}
}
示例4: create
import rx.functions.Action0; //导入方法依赖的package包/类
public static final <T> Subscriber<T> create(final Action1<? super T> onNext, final Action1<Throwable> onError, final Action0 onComplete) {
if (onNext == null) {
throw new IllegalArgumentException("onNext can not be null");
} else if (onError == null) {
throw new IllegalArgumentException("onError can not be null");
} else if (onComplete != null) {
return new Subscriber<T>() {
public final void onCompleted() {
onComplete.call();
}
public final void onError(Throwable e) {
onError.call(e);
}
public final void onNext(T args) {
onNext.call(args);
}
};
} else {
throw new IllegalArgumentException("onComplete can not be null");
}
}
示例5: unsubscribe
import rx.functions.Action0; //导入方法依赖的package包/类
public final void unsubscribe() {
if (((Action0) this.actionRef.get()) != EMPTY_ACTION) {
Action0 action = (Action0) this.actionRef.getAndSet(EMPTY_ACTION);
if (action != null && action != EMPTY_ACTION) {
action.call();
}
}
}
示例6: disposeEagerlyIfRequested
import rx.functions.Action0; //导入方法依赖的package包/类
private Throwable disposeEagerlyIfRequested(Action0 disposeOnceOnly) {
Throwable th = null;
if (this.disposeEagerly) {
try {
disposeOnceOnly.call();
} catch (Throwable th2) {
th = th2;
}
}
return th;
}
示例7: createStateless
import rx.functions.Action0; //导入方法依赖的package包/类
@Experimental
public static <T> Observable$OnSubscribe<T> createStateless(final Action2<Long, ? super Observer<Observable<? extends T>>> next, final Action0 onUnsubscribe) {
return new AsyncOnSubscribeImpl(new Func3<Void, Long, Observer<Observable<? extends T>>, Void>() {
public Void call(Void state, Long requested, Observer<Observable<? extends T>> subscriber) {
next.call(requested, subscriber);
return null;
}
}, new Action1<Void>() {
public void call(Void t) {
onUnsubscribe.call();
}
});
}
示例8: createStateless
import rx.functions.Action0; //导入方法依赖的package包/类
@Experimental
public static <T> Observable$OnSubscribe<T> createStateless(final Action1<? super Observer<? super T>> next, final Action0 onUnsubscribe) {
return new SyncOnSubscribeImpl(new Func2<Void, Observer<? super T>, Void>() {
public Void call(Void state, Observer<? super T> subscriber) {
next.call(subscriber);
return null;
}
}, new Action1<Void>() {
public void call(Void t) {
onUnsubscribe.call();
}
});
}
示例9: schedule
import rx.functions.Action0; //导入方法依赖的package包/类
public Subscription schedule(Action0 action) {
action.call();
return Subscriptions.unsubscribed();
}