trait Scheduling extends AnyRef
- Alphabetic
- By Inheritance
- Scheduling
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
runPeriodically[R](firstRun: DateTime, whenToReRun: ⇒ Option[DateTime])(f: ⇒ R): Unit
periodically runs f, starting on firstRun and repeating according to the calculated "process" value.
periodically runs f, starting on firstRun and repeating according to the calculated "process" value.
example:
import org.scala_tools.time.Imports._ val executorService = ExecutorServiceManager.newScheduledThreadPool(5) val start = System.currentTimeMillis executorService.runPeriodically(DateTime.now + 50.millis, Some(DateTime.now + 1.second)) { // should print dt 6 times, once per second println("dt:%d".format(System.currentTimeMillis - start)) } Thread.sleep(5500) executorService.shutdownAndAwaitTermination(DateTime.now + 100.millis)
If the task throws an exception, the onError function will be called to log the error (by default it prints the stacktrace to the console)
If the process throws an exception, the scheduling of the task will stop.
- firstRun
DateTime of the first run, i.e. DateTime.now + 2.seconds
- whenToReRun
a by-value parameter specifying the next time the task should run. The value is calculated after f is executed and if None the task will not be executed anymore.
- f
the task
-
def
runPeriodically[R](firstRun: DateTime, process: (Option[R]) ⇒ Option[DateTime])(f: ⇒ R): Unit
runs a task periodically.
runs a task periodically. The task initially runs on firstTime. The result R is then used to call process(R) and if that returns a new DateTime, the task will be executed again on that time. If process(R) returns None, the task won't be executed again.
This method returns straight away, any processing occurs on separate threads using the executor.
If the task throws an exception, the onError function will be called to log the error (by default it prints the stacktrace to the console)
If the process throws an exception, the scheduling of the task will stop.
- firstRun
DateTime of the first run, i.e. DateTime.now + 2.seconds
- process
a function to process the result and specify the next time the task should run. The value is calculated after f is executed and if None the task will not be executed anymore.
- f
the task
-
def
schedule[R](runAt: DateTime): (⇒ R) ⇒ ScheduledFuture[R]
schedule a task to run in the future.
schedule a task to run in the future.
example:
usage: val future=schedule(DateTime.now + 2.days) { // to do in 2 days from now }
-
def
schedule[R](delay: Long, unit: TimeUnit)(f: ⇒ R): ScheduledFuture[R]
schedules a task to run in the future
schedules a task to run in the future
example:
val future=schedule(100,TimeUnit.MILLISECONDS) { // to do in 100 millis from now } ... val result=future.get
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )