Locking Mechanism

The locking mechanism implementation process is explained in this topic.

Procedure

  1. When a timer task starts processing, it tries to acquire a lock.
  2. If it finds a lock file, it skips processing.
  3. If a lock file is not found, a lock file is created and the Node ID information of the server is added to the lock file. The lock files are created in the following directories:
    • MqRevivify: $MQ_HOME/Work/MqRevivify.lock
    • FileWatcher: Location can be specified in the FileWatcher.xml file.
      Note: If multiple files are being processed (using Filewatcher), ensure the lock file is enabled in the filewatcher.xml file (enabled by default).

      The lock file contains the local host information so that the host JVM that created it can be identified. It contains the application Node ID and host identifier. This needs to be done so that only the owner can purge the file later.

  4. After the task is completed, the lock file is deleted.