Class CENTRAL_LOCK

  • All Implemented Interfaces:
    LockNotification, Lifecycle

    @Deprecated
    public class CENTRAL_LOCK
    extends Locking
    implements LockNotification
    Deprecated.
    See http://belaban.blogspot.com/2020/11/i-hate-distributed-locks.html.
    Implementation of a locking protocol which acquires locks by contacting the coordinator.

    Because the coordinator maintains all locks, no total order configuration is required.

    CENTRAL_LOCK has all members send lock and unlock requests to a central coordinator. The coordinator has a queue for incoming requests, and grants locks based on order of arrival. To prevent all acquired locks from being forgotten when the coordinator crashes, setting num_backups lets the coordinator backup lock information to a number of backup nodes. Valid values for num_backups are 0 (no backup) to N-1, e.g. in a cluster of 4, we can have only 3 backup nodes.

    Say we have a cluster of {A,B,C,D,E} and num_backups=1. A is the coordinator, and A updates all locks (and released locks) in B as well. When A crashes, everybody falls over to B for sending lock and unlock requests. B in turn copies all existing locks over to C and - when locks are acquired or released - forwards this information to C as well.
    Since:
    2.12
    Author:
    Bela Ban
    See Also:
    Locking
    • Field Detail

      • num_backups

        protected int num_backups
        Deprecated.
      • coord

        protected Address coord
        Deprecated.
      • is_coord

        protected boolean is_coord
        Deprecated.
      • backups

        protected final java.util.List<Address> backups
        Deprecated.
    • Constructor Detail

      • CENTRAL_LOCK

        public CENTRAL_LOCK()
        Deprecated.
    • Method Detail

      • getCoord

        public Address getCoord()
        Deprecated.
      • isCoord

        public boolean isCoord()
        Deprecated.
      • getCoordinator

        public java.lang.String getCoordinator()
        Deprecated.
      • getNumberOfBackups

        public int getNumberOfBackups()
        Deprecated.
      • setNumberOfBackups

        public CENTRAL_LOCK setNumberOfBackups​(int num_backups)
        Deprecated.
      • getBackups

        public java.lang.String getBackups()
        Deprecated.
      • sendGrantLockRequest

        protected void sendGrantLockRequest​(java.lang.String lock_name,
                                            int lock_id,
                                            Owner owner,
                                            long timeout,
                                            boolean is_trylock)
        Deprecated.
        Specified by:
        sendGrantLockRequest in class Locking
      • sendReleaseLockRequest

        protected void sendReleaseLockRequest​(java.lang.String lock_name,
                                              int lock_id,
                                              Owner owner)
        Deprecated.
        Specified by:
        sendReleaseLockRequest in class Locking
      • sendCreateLockRequest

        protected void sendCreateLockRequest​(Address dest,
                                             java.lang.String lock_name,
                                             Owner owner)
        Deprecated.
      • sendDeleteLockRequest

        protected void sendDeleteLockRequest​(Address dest,
                                             java.lang.String lock_name)
        Deprecated.
      • sendAwaitConditionRequest

        protected void sendAwaitConditionRequest​(java.lang.String lock_name,
                                                 Owner owner)
        Deprecated.
        Specified by:
        sendAwaitConditionRequest in class Locking
      • sendSignalConditionRequest

        protected void sendSignalConditionRequest​(java.lang.String lock_name,
                                                  boolean all)
        Deprecated.
        Specified by:
        sendSignalConditionRequest in class Locking
      • handleView

        public void handleView​(View view)
        Deprecated.
        Overrides:
        handleView in class Locking
      • lockCreated

        public void lockCreated​(java.lang.String name)
        Deprecated.
        Specified by:
        lockCreated in interface LockNotification
      • lockDeleted

        public void lockDeleted​(java.lang.String name)
        Deprecated.
        Specified by:
        lockDeleted in interface LockNotification
      • locked

        public void locked​(java.lang.String lock_name,
                           Owner owner)
        Deprecated.
        Specified by:
        locked in interface LockNotification
      • unlocked

        public void unlocked​(java.lang.String lock_name,
                             Owner owner)
        Deprecated.
        Specified by:
        unlocked in interface LockNotification
      • lockRevoked

        public void lockRevoked​(java.lang.String lock_name,
                                Owner current_owner)
        Deprecated.
        Specified by:
        lockRevoked in interface LockNotification
      • awaiting

        public void awaiting​(java.lang.String lock_name,
                             Owner owner)
        Deprecated.
        Specified by:
        awaiting in interface LockNotification
      • awaited

        public void awaited​(java.lang.String lock_name,
                            Owner owner)
        Deprecated.
        Specified by:
        awaited in interface LockNotification
      • updateBackups

        protected void updateBackups​(Locking.Type type,
                                     java.lang.String lock_name,
                                     Owner owner)
        Deprecated.
      • copyLocksTo

        protected void copyLocksTo​(java.util.List<Address> new_joiners)
        Deprecated.