当前位置: 首页>>代码示例>>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;未经允许,请勿转载。