trait ScheduledLockService extends AnyRef
A locking implementation for scheduled tasks that will only execute the body when a new lock has been acquired.
The lock's ttl is set to be schedulerInterval + 1 second, meaning that the instance that currently owns the lock
will always have a chance to refresh the lock and extend the ttl.
If the lock is successfully refreshed, then body will not be executed, as being able to refresh the lock signals
that the body of the previous invocation hasn't yet completed.
Once the body has completed it will either:
- Release the lock immediately, when the
bodyhas taken longer than theschedulerIntervalto complete - Disown the lock and amend the ttl to reflect the cadence of the scheduled task
In the event that the scheduled task ends in failure, the lock will be released immediately.
- Alphabetic
- By Inheritance
- ScheduledLockService
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract val lockId: String
- abstract val lockRepository: LockRepository
- abstract val schedulerInterval: Duration
- abstract val timestampSupport: TimestampSupport
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[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- 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(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withLock[T](body: => Future[T])(implicit ec: ExecutionContext): Future[Option[T]]
Runs
bodyonly when a new lock has been acquired, the instance that owns the lock will continue to refresh the lock until thebodyhas completed.Runs
bodyonly when a new lock has been acquired, the instance that owns the lock will continue to refresh the lock until thebodyhas completed.Once the
bodyhas completed, the lock will either be released immediately or abandoned depending upon how longbodytook to complete.