All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.mlsql.scheduler.algorithm.TimeScheduler.scala Maven / Gradle / Ivy

The newest version!
package tech.mlsql.scheduler.algorithm

import java.util.TimeZone

import it.sauronsoftware.cron4j.{Scheduler, TaskCollector}

/**
  * 2019-09-05 WilliamZhu([email protected])
  */
object TimeScheduler {
  val scheduler = new Scheduler()

  def start(tc: TaskCollector, timeZone: String) = {
    if (!scheduler.isStarted) {
      scheduler.setTimeZone(TimeZone.getTimeZone(timeZone))
      scheduler.addTaskCollector(tc)
      scheduler.start()
    }
  }

  def stop() = {
    scheduler.stop()
  }
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy