uk.gov.hmrc.mongo.lock

Members list

Type members

Classlikes

case class Lock(id: String, owner: String, timeCreated: Instant, expiryTime: Instant)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Lock

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Lock.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait LockService

For locking for a particular task. The lock will be released when the task has finished.

For locking for a particular task. The lock will be released when the task has finished.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object LockService

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
@Singleton
class MongoLockRepository(mongoComponent: MongoComponent, timestampSupport: TimestampSupport)(implicit ec: ExecutionContext) extends PlayMongoRepository[Lock], LockRepository

Attributes

Supertypes
trait MongoDatabaseCollection
class Object
trait Matchable
class Any
Show all

A locking implementation for scheduled tasks that will only execute the body when a new lock has been acquired.

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 body has taken longer than the schedulerInterval to 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.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

For locking for a give time period (i.e. stop other instances executing the task until it stops renewing the lock). The lock will be held on to when the task has finished, until it expires.

For locking for a give time period (i.e. stop other instances executing the task until it stops renewing the lock). The lock will be held on to when the task has finished, until it expires.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type