Class Lock

java.lang.Object
com.atlassian.jira.util.Lock

public class Lock extends Object
Used to lock resources using a file system file as a lock
  • Field Details

  • Constructor Details

    • Lock

      public Lock(String fileName)
    • Lock

      public Lock(String directoryName, String fileName)
  • Method Details

    • obtain

      public boolean obtain() throws IOException
      Throws:
      IOException
    • obtain

      public boolean obtain(long timeout) throws IOException
      Try to obtain a lock, wait for timeout ms if necessary
      Parameters:
      timeout - number of milliseconds to wait for (if necessary)
      Returns:
      try if the lock was successfully obtained, false otherwise
      Throws:
      IOException - if an error occurs creating the lock
    • release

      public void release()
    • isLocked

      public boolean isLocked()
    • getLockFilePath

      public String getLockFilePath()