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


Java Cancellable.cancel方法代码示例

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


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

示例1: scheduleWeeklyReport

import akka.actor.Cancellable; //导入方法依赖的package包/类
private void scheduleWeeklyReport() {
    FiniteDuration delay = FiniteDuration.create(secondsUntilNextMondayRun(), TimeUnit.SECONDS);
    Cancellable reportTask = tasks.remove("REPORT_SENDER");
    if (reportTask != null) {
        reportTask.cancel();
    }
    tasks.put("REPORT_SENDER", system.scheduler().scheduleOnce(delay, () -> {
        Logger.info("Running weekly email report");
        List<User> teachers = Ebean.find(User.class)
                .fetch("language")
                .where()
                .eq("roles.name", "TEACHER")
                .findList();
        teachers.forEach(t -> {
            try {
                composer.composeWeeklySummary(t);
            } catch (RuntimeException e) {
                Logger.error("Failed to send email for {}", t.getEmail());
            }
        });
        // Reschedule
        scheduleWeeklyReport();
    }, system.dispatcher()));
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:25,代码来源:SystemInitializer.java

示例2: onSelectOwner

import akka.actor.Cancellable; //导入方法依赖的package包/类
private void onSelectOwner(final SelectOwner selectOwner) {
    LOG.debug("{}: onSelectOwner: {}", persistenceId(), selectOwner);

    String currentOwner = getCurrentOwner(selectOwner.getEntityPath());
    if (Strings.isNullOrEmpty(currentOwner)) {
        writeNewOwner(selectOwner.getEntityPath(), newOwner(currentOwner, selectOwner.getAllCandidates(),
                selectOwner.getOwnerSelectionStrategy()));

        Cancellable cancellable = entityToScheduledOwnershipTask.get(selectOwner.getEntityPath());
        if (cancellable != null) {
            if (!cancellable.isCancelled()) {
                cancellable.cancel();
            }
            entityToScheduledOwnershipTask.remove(selectOwner.getEntityPath());
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:EntityOwnershipShard.java

示例3: terminated

import akka.actor.Cancellable; //导入方法依赖的package包/类
void terminated(ActorRef child) {
    Cancellable scheduledTermination = scheduledTerminations.get(child);
    if (scheduledTermination != null) {
        // The child terminated in time, so we should cancel the scheduled termination.
        scheduledTermination.cancel();
    }
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:8,代码来源:MasterInterpreterActor.java

示例4: cancel

import akka.actor.Cancellable; //导入方法依赖的package包/类
public void cancel() {
    log.info("***** START cancel JobsServiceImpl ****");
    for (Cancellable scheduler : schedulers) {
        if (scheduler != null) {
            scheduler.cancel();
            log.info("***** Scheduler was not null and is cancelled ****");
        }
    }
    log.info("***** END cancel JobsServiceImpl ****");
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:11,代码来源:JobsServiceImpl.java

示例5: cancelOwnerSelectionTask

import akka.actor.Cancellable; //导入方法依赖的package包/类
private void cancelOwnerSelectionTask(final YangInstanceIdentifier entityPath) {
    final Cancellable lastScheduledTask = entityToScheduledOwnershipTask.get(entityPath);
    if (lastScheduledTask != null && !lastScheduledTask.isCancelled()) {
        lastScheduledTask.cancel();
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:EntityOwnershipShard.java

示例6: run

import akka.actor.Cancellable; //导入方法依赖的package包/类
/** Run the Monitor. */
    public final void run() {
    	    	  	
		systemMonitor = ActorSystem.create("MonitorSystem"); 
		//creation de l'actor Action
		action = systemMonitor.actorOf(new Props(new UntypedActorFactory() {
			public UntypedActor create() {
			 return new Action(controllerSoftwareService,controllerVmService,controllerKubectlService,nameReplicationController);
			}
		}), "Actionneur");	
		//creation de l'actor Decide
		decide = systemMonitor.actorOf(new Props(new UntypedActorFactory() {
			public UntypedActor create() {
			 return new Decide(action,sh,eventNotificationAlertService);
			}
		}), "Decideur");	
		//creation l'actor Analyse
		analyse = systemMonitor.actorOf(new Props(new UntypedActorFactory() {
			public UntypedActor create() {
			 return new Analyse(decide,sh,eventNotificationAlertService);
			}
		}), "Analyseur");
		
		//creation de l'actor Collect des traces de la version Japonais de Wikipedia
//		collect = systemMonitor.actorOf(new Props(new UntypedActorFactory() {
//			public UntypedActor create() {
//			 return new CollectTraceWikipedia(analyse,sh);
//			}
//		}), "Collect");

		//creation de l'actor Collect en temps réel
		collect = systemMonitor.actorOf(new Props(new UntypedActorFactory() {
			public UntypedActor create() {
			 return new CollectRealTime(analyse,sh);
			}
		}), "Collect");
		
		
		  System.out.println("START");
		  //lecture du nombre de requettes tous les 30 secondes
		  Cancellable cancellable = systemMonitor.scheduler().schedule(Duration.Zero(),Duration.create(30, "seconds"),collect, new Interval(30));				  
		  try {
			  Thread.sleep(30000000);
			} catch (InterruptedException e) {
				System.out.println(e.getStackTrace());
				return;
			}
		 
		  cancellable.cancel();
		  System.out.println("END");   	
    }
 
开发者ID:Spirals-Team,项目名称:peak-forecast,代码行数:52,代码来源:Monitor.java


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