public class

Lock

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

Class Overview

Used to lock resources using a file system file as a lock

Summary

Constants
long LOOP_WAIT_TIME
Public Constructors
Lock(String fileName)
Lock(String directoryName, String fileName)
Public Methods
String getLockFilePath()
boolean isLocked()
boolean obtain(long timeout)
Try to obtain a lock, wait for timeout ms if necessary
boolean obtain()
void release()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final long LOOP_WAIT_TIME

Constant Value: 1000 (0x00000000000003e8)

Public Constructors

public Lock (String fileName)

public Lock (String directoryName, String fileName)

Public Methods

public String getLockFilePath ()

public boolean isLocked ()

public boolean obtain (long timeout)

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

public boolean obtain ()

Throws
IOException

public void release ()