/** * 注册作业启动信息. * * @param jobExecutionShardingContext 作业运行时分片上下文 */ public void registerJobBegin( final JobExecutionMultipleShardingContext jobExecutionShardingContext) { if (!jobExecutionShardingContext.getShardingItems().isEmpty() && configService.isMonitorExecution()) { serverService.updateServerStatus(ServerStatus.RUNNING); for (int each : jobExecutionShardingContext.getShardingItems()) { jobNodeStorage.fillEphemeralJobNode(ExecutionNode.getRunningNode(each), ""); jobNodeStorage.replaceJobNode( ExecutionNode.getLastBeginTimeNode(each), System.currentTimeMillis()); Date nextFireTime = JobRegistry.getInstance().getJob(jobConfiguration.getJobName()).getNextFireTime(); if (null != nextFireTime) { jobNodeStorage.replaceJobNode( ExecutionNode.getNextFireTimeNode(each), nextFireTime.getTime()); } } } }
@Test public void assertGetNextFireTimeNode() { assertThat(ExecutionNode.getNextFireTimeNode(0), is("execution/0/nextFireTime")); }