Class Mutex

java.lang.Object
org.tasktide.mutex.model.Mutex

public class Mutex extends Object
Model class for MutexActor
  • Constructor Details

    • Mutex

      public Mutex(String id, long timestamp, Path lockDir, Path lockFile, Path hostFile, Path electionFile, Duration retryInterval, Duration staleFileThreshold, Duration startJitter, Duration endJitter, MutexState state)
      Construct with properties
      Parameters:
      id -
      timestamp -
      lockDir -
      lockFile -
      hostFile -
      electionFile -
      retryInterval -
      staleFileThreshold -
      startJitter -
      endJitter -
      state -
  • Method Details

    • getConfirmBallot

      public Path getConfirmBallot()
    • setConfirmBallot

      public void setConfirmBallot(Path confirmBallot)
    • getLockDir

      public Path getLockDir()
      Get locking directory
      Returns:
      Path
    • getLockFile

      public Path getLockFile()
      Get lock central file
      Returns:
      Path
    • getHostFile

      public Path getHostFile()
      Get host lock file
      Returns:
      Path
    • getRetryInterval

      public Duration getRetryInterval()
      Retry interval between lock attempts
      Returns:
      Duration
    • getStaleFileThreshold

      public Duration getStaleFileThreshold()
      Stale file threshold
      Returns:
      Duration
    • getStartJitter

      public Duration getStartJitter()
      Get start jitter
      Returns:
      Duration
    • getEndJitter

      public Duration getEndJitter()
      Get end jitter
      Returns:
      Duration
    • getState

      public MutexState getState()
      Get current MutexState
      Returns:
      MutexState
    • setState

      public void setState(MutexState state)
      Set new MutexState
      Parameters:
      state -
    • getId

      public String getId()
      Fetch Id
      Returns:
      String
    • getTimestamp

      public long getTimestamp()
      Get mutex timestamp
      Returns:
      long
    • getElectionFile

      public Path getElectionFile()
      Get election file
      Returns:
      Path
    • getFileForType

      public Path getFileForType(MutexFileType fileType)
      Get the path for supplied MutexFileType, or unchecked exception
      Parameters:
      fileType -
      Returns:
      Path
    • getHostLock

      public HostLock getHostLock()
      Get host lock
      Returns:
      HostLock
    • setHostLock

      public void setHostLock(HostLock hostLock)
      Parameters:
      hostLock -
    • toJsonDoc

      public String toJsonDoc()
      Represent as JSON document
      Returns:
      String
    • setTimestamp

      public void setTimestamp(long timestamp)
    • setElectionFile

      public void setElectionFile(Path electionFile)
    • setRetryInterval

      public void setRetryInterval(Duration retryInterval)
    • setStaleFileThreshold

      public void setStaleFileThreshold(Duration staleFileThreshold)
    • setStartJitter

      public void setStartJitter(Duration startJitter)
    • setEndJitter

      public void setEndJitter(Duration endJitter)
    • toString

      public String toString()
      Represent as string
      Overrides:
      toString in class Object
      Returns:
      String