• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ScheduledAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中rx.internal.schedulers.ScheduledAction的典型用法代码示例。如果您正苦于以下问题:Java ScheduledAction类的具体用法?Java ScheduledAction怎么用?Java ScheduledAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ScheduledAction类属于rx.internal.schedulers包,在下文中一共展示了ScheduledAction类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
public Subscription schedule(Action0 action) {
    if (isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }
    Subscription ea = new ScheduledAction(action, this.tasks);
    this.tasks.add(ea);
    this.queue.offer(ea);
    if (this.wip.getAndIncrement() != 0) {
        return ea;
    }
    try {
        this.executor.execute(this);
        return ea;
    } catch (RejectedExecutionException t) {
        this.tasks.remove(ea);
        this.wip.decrementAndGet();
        RxJavaPlugins.getInstance().getErrorHandler().handleError(t);
        throw t;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:ExecutorScheduler.java


示例2: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
  if (compositeSubscription.isUnsubscribed()) {
    return Subscriptions.unsubscribed();
  }

  action = RxAndroidPlugins.getInstance().getSchedulersHook().onSchedule(action);

  final ScheduledAction scheduledAction = new ScheduledAction(action);
  scheduledAction.addParent(compositeSubscription);
  compositeSubscription.add(scheduledAction);

  handler.postDelayed(scheduledAction, unit.toMillis(delayTime));

  scheduledAction.add(Subscriptions.create(new Action0() {
    @Override public void call() {
      //Log.e(TAG, "HandlerScheduler has unsubscribed");
      handler.removeCallbacks(scheduledAction);
    }
  }));

  return scheduledAction;
}
 
开发者ID:J1aDong,项目名称:Gank-Meizi,代码行数:23,代码来源:HandlerScheduler.java


示例3: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (compositeSubscription.isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }

    action = RxAndroidPlugins.getInstance().getSchedulersHook().onSchedule(action);

    final ScheduledAction scheduledAction = new ScheduledAction(action);
    scheduledAction.addParent(compositeSubscription);
    compositeSubscription.add(scheduledAction);

    handler.postDelayed(scheduledAction, unit.toMillis(delayTime));

    scheduledAction.add(Subscriptions.create(new Action0() {
        @Override
        public void call() {
            handler.removeCallbacks(scheduledAction);
        }
    }));

    return scheduledAction;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:24,代码来源:HandlerScheduler.java


示例4: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override
public Subscription schedule(final Action0 action, long delayTime, TimeUnit unit) {
    final ScheduledAction scheduledAction = new ScheduledAction(action);
    scheduledAction.add(Subscriptions.create(new Action0() {
        @Override
        public void call() {
            handler.removeCallbacks(scheduledAction);
        }
    }));
    scheduledAction.addParent(compositeSubscription);
    compositeSubscription.add(scheduledAction);

    handler.postDelayed(scheduledAction, unit.toMillis(delayTime));

    return scheduledAction;
}
 
开发者ID:hello,项目名称:android-buruberi,代码行数:17,代码来源:Rx.java


示例5: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override
public Subscription schedule(Action0 action, long delayTime, TimeUnit timeUnit) {
    final ScheduledAction scheduledAction = new ScheduledAction(action);
    scheduledAction.addParent(compositeSubscription);
    compositeSubscription.add(scheduledAction);

    final int taskId = BukkitRxScheduler.scheduleOnBukkitScheduler(plugin, scheduledAction, timeUnitToBukkitTicks(delayTime, timeUnit), concurrencyMode);
    scheduledAction.add(Subscriptions.create(new Action0() {
        @Override
        public void call() {
            plugin.getServer().getScheduler().cancelTask(taskId);
        }
    }));

    return scheduledAction;
}
 
开发者ID:rmichela,项目名称:rxjava-bukkit,代码行数:17,代码来源:BukkitRxScheduler.java


示例6: run

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
public void run() {
    do {
        ScheduledAction sa = (ScheduledAction) this.queue.poll();
        if (!sa.isUnsubscribed()) {
            sa.run();
        }
    } while (this.wip.decrementAndGet() > 0);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:ExecutorScheduler.java


示例7: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (this.compositeSubscription.isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }
    final Subscription scheduledAction = new ScheduledAction(RxAndroidPlugins.getInstance().getSchedulersHook().onSchedule(action));
    scheduledAction.addParent(this.compositeSubscription);
    this.compositeSubscription.add(scheduledAction);
    this.handler.postDelayed(scheduledAction, unit.toMillis(delayTime));
    scheduledAction.add(Subscriptions.create(new Action0() {
        public void call() {
            HandlerWorker.this.handler.removeCallbacks(scheduledAction);
        }
    }));
    return scheduledAction;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:16,代码来源:HandlerScheduler.java


示例8: testNoSelfInterrupt

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Test(timeout = 3000)
public void testNoSelfInterrupt() throws InterruptedException {
    Scheduler.Worker worker = Schedulers.newThread().createWorker();
    try {
        final CountDownLatch run = new CountDownLatch(1);
        final CountDownLatch done = new CountDownLatch(1);
        final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
        final AtomicBoolean interruptFlag = new AtomicBoolean();
        
        ScheduledAction sa = (ScheduledAction)worker.schedule(new Action0() {
            @Override
            public void call() {
                try {
                    run.await();
                } catch (InterruptedException ex) {
                    exception.set(ex);
                }
            }
        });
        
        sa.add(Subscriptions.create(new Action0() {
            @Override
            public void call() {
                interruptFlag.set(Thread.currentThread().isInterrupted());
                done.countDown();
            }
        }));
        
        run.countDown();
        
        done.await();
        
        Assert.assertEquals(null, exception.get());
        Assert.assertFalse("Interrupted?!", interruptFlag.get());
    } finally {
        worker.unsubscribe();
    }
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:39,代码来源:NewThreadSchedulerTest.java


示例9: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (innerSubscription.isUnsubscribed()) {
        // don't schedule, we are unsubscribed
        return Subscriptions.empty();
    }

    ScheduledAction s = worker.scheduleActual(action, delayTime, unit);
    innerSubscription.add(s);
    s.addParent(innerSubscription);
    return s;
}
 
开发者ID:OpenSilk,项目名称:SyncthingAndroid,代码行数:13,代码来源:SingleThreadScheduler.java


示例10: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (innerSubscription.isUnsubscribed()) {
        // don't schedule, we are unsubscribed
        return Subscriptions.empty();
    }
    
    ScheduledAction s = (ScheduledAction)innerWorker.schedule(action, delayTime, unit);
    innerSubscription.add(s);
    s.addParent(innerSubscription);
    return s;
}
 
开发者ID:Matthias247,项目名称:adalightserver,代码行数:13,代码来源:SingleThreadedComputationScheduler.java


示例11: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override
public Subscription schedule(Action0 action) {
    if (isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }
    ScheduledAction s = poolWorker.scheduleActual(action, 0, null, serial);

    return s;
}
 
开发者ID:couchbase,项目名称:couchbase-jvm-core,代码行数:10,代码来源:CoreScheduler.java


示例12: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (innerSubscription.isUnsubscribed()) {
        // don't schedule, we are unsubscribed
        return Subscriptions.empty();
    }

    ScheduledAction s = threadWorker.scheduleActual(action, delayTime, unit);
    innerSubscription.add(s);
    s.addParent(innerSubscription);
    return s;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:13,代码来源:CachedThreadScheduler.java


示例13: schedule

import rx.internal.schedulers.ScheduledAction; //导入依赖的package包/类
@Override
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (innerSubscription.isUnsubscribed()) {
        // don't schedule, we are unsubscribed
        return Subscriptions.empty();
    }
    
    ScheduledAction s = poolWorker.scheduleActual(action, delayTime, unit);
    innerSubscription.add(s);
    s.addParent(innerSubscription);
    return s;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:13,代码来源:EventLoopsScheduler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IIOMetadataFormatImpl类代码示例发布时间:2022-05-21
下一篇:
Java Symbol类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap