Class DBLock

java.lang.Object
com.landawn.abacus.jdbc.DBLock

public final class DBLock extends Object
Supports global lock by db table.
Since:
0.8
Author:
Haiyang Li
  • Field Details

  • Method Details

    • lock

      public String lock(String target)
      Parameters:
      target -
      Returns:
    • lock

      public String lock(String target, long timeout)
      Parameters:
      target -
      timeout -
      Returns:
    • lock

      public String lock(String target, long liveTime, long timeout)
      Parameters:
      target -
      liveTime -
      timeout -
      Returns:
    • lock

      public String lock(String target, long liveTime, long timeout, long retryPeriod)
      Parameters:
      target -
      liveTime -
      timeout -
      retryPeriod - the period to retry inserting record in database table to lock the target.
      Returns:
      null if the target can't be locked in the period specified by timeout
    • unlock

      public boolean unlock(String target, String code)
      Parameters:
      target -
      code -
      Returns:
      true, if successful
    • close

      public void close()
      Close.