Class ExecLock

  • All Implemented Interfaces:
    Locker

    public class ExecLock
    extends Object
    implements Locker
    This class define a lock to prevent execution of a process simultaneously on multiples JVM.
    Since:
    1.1
    Author:
    Laurent Jourdren
    • Constructor Detail

      • ExecLock

        public ExecLock​(String execName,
                        File tmpDir)
        Public constructor.
        Parameters:
        execName - resource name
        tmpDir - temporary directory where to create lock files
      • ExecLock

        public ExecLock​(String execName)
        Public constructor.
        Parameters:
        execName - resource name
    • Method Detail

      • lock

        public void lock()
        Description copied from interface: Locker
        Wait the token and then lock the resource.
        Specified by:
        lock in interface Locker
      • unlock

        public void unlock()
        Description copied from interface: Locker
        Unlock the resource.
        Specified by:
        unlock in interface Locker
      • getProcessesWaiting

        public int getProcessesWaiting()
        Get the number of processes waiting.
        Returns:
        the number of process waiting