当前位置: 首页>>代码示例>>Java>>正文


Java Worker.schedulePeriodically方法代码示例

本文整理汇总了Java中rx.Scheduler.Worker.schedulePeriodically方法的典型用法代码示例。如果您正苦于以下问题:Java Worker.schedulePeriodically方法的具体用法?Java Worker.schedulePeriodically怎么用?Java Worker.schedulePeriodically使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rx.Scheduler.Worker的用法示例。


在下文中一共展示了Worker.schedulePeriodically方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: call

import rx.Scheduler.Worker; //导入方法依赖的package包/类
public void call(final Subscriber<? super Long> child) {
    final Worker worker = this.scheduler.createWorker();
    child.add(worker);
    worker.schedulePeriodically(new Action0() {
        long counter;

        public void call() {
            try {
                Subscriber subscriber = child;
                long j = this.counter;
                this.counter = 1 + j;
                subscriber.onNext(Long.valueOf(j));
            } catch (Throwable e) {
                worker.unsubscribe();
            } finally {
                Exceptions.throwOrReport(e, child);
            }
        }
    }, this.initialDelay, this.period, this.unit);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:OnSubscribeTimerPeriodically.java

示例2: start

import rx.Scheduler.Worker; //导入方法依赖的package包/类
public void start() {
    Worker w = Schedulers.computation().createWorker();
    if (this.schedulerWorker.compareAndSet(null, w)) {
        w.schedulePeriodically(new Action0() {
            public void call() {
                int size = ObjectPool.this.pool.size();
                int i;
                if (size < ObjectPool.this.minSize) {
                    int sizeToBeAdded = ObjectPool.this.maxSize - size;
                    for (i = 0; i < sizeToBeAdded; i++) {
                        ObjectPool.this.pool.add(ObjectPool.this.createObject());
                    }
                } else if (size > ObjectPool.this.maxSize) {
                    int sizeToBeRemoved = size - ObjectPool.this.maxSize;
                    for (i = 0; i < sizeToBeRemoved; i++) {
                        ObjectPool.this.pool.poll();
                    }
                }
            }
        }, this.validationInterval, this.validationInterval, TimeUnit.SECONDS);
    } else {
        w.unsubscribe();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:ObjectPool.java

示例3: call

import rx.Scheduler.Worker; //导入方法依赖的package包/类
@Override
public void call(final Subscriber<? super Long> child) {
    final Worker worker = scheduler.createWorker();
    child.add(worker);
    worker.schedulePeriodically(new Action0() {
        long counter;
        @Override
        public void call() {
            try {
                child.onNext(counter++);
            } catch (Throwable e) {
                try {
                    child.onError(e);
                } finally {
                    worker.unsubscribe();
                }
            }
        }
        
    }, initialDelay, period, unit);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:22,代码来源:OnSubscribeTimerPeriodically.java

示例4: call

import rx.Scheduler.Worker; //导入方法依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> child) {
    SerializedSubscriber<T> s = new SerializedSubscriber(child);
    Worker worker = this.scheduler.createWorker();
    child.add(worker);
    SamplerSubscriber<T> sampler = new SamplerSubscriber(s);
    child.add(sampler);
    worker.schedulePeriodically(sampler, this.time, this.time, this.unit);
    return sampler;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:OperatorSampleWithTime.java

示例5: call

import rx.Scheduler.Worker; //导入方法依赖的package包/类
@Override
public Subscriber<? super T> call(Subscriber<? super T> child) {
    final SerializedSubscriber<T> s = new SerializedSubscriber<T>(child);
    final Worker worker = scheduler.createWorker();
    child.add(worker);
    
    SamplerSubscriber<T> sampler = new SamplerSubscriber<T>(s);
    child.add(sampler);
    worker.schedulePeriodically(sampler, time, time, unit);

    return sampler;
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:13,代码来源:OperatorSampleWithTime.java

示例6: call

import rx.Scheduler.Worker; //导入方法依赖的package包/类
@Override
public Subscriber<? super T> call(Subscriber<? super T> child) {
    final SerializedSubscriber<T> s = new SerializedSubscriber<T>(child);
    final Worker worker = scheduler.createWorker();
    child.add(worker);
    
    SamplerSubscriber<T> sampler = new SamplerSubscriber<T>(s);
    worker.schedulePeriodically(sampler, time, time, unit);

    return sampler;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:12,代码来源:OperatorSampleWithTime.java


注:本文中的rx.Scheduler.Worker.schedulePeriodically方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。