當前位置: 首頁>>代碼示例>>Java>>正文


Java Action0.call方法代碼示例

本文整理匯總了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);
}
 
開發者ID:Azure,項目名稱:azure-libraries-for-java,代碼行數:25,代碼來源:DnsZoneRecordSetETagTests.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:24,代碼來源:Scheduler.java

示例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");
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:24,代碼來源:Observers.java

示例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");
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:24,代碼來源:Subscribers.java

示例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();
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:9,代碼來源:BooleanSubscription.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:12,代碼來源:OnSubscribeUsing.java

示例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();
        }
    });
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:14,代碼來源:AsyncOnSubscribe.java

示例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();
        }
    });
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:14,代碼來源:SyncOnSubscribe.java

示例9: schedule

import rx.functions.Action0; //導入方法依賴的package包/類
public Subscription schedule(Action0 action) {
    action.call();
    return Subscriptions.unsubscribed();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:5,代碼來源:ImmediateScheduler.java


注:本文中的rx.functions.Action0.call方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。