Class Locking

  • All Implemented Interfaces:
    Lifecycle
    Direct Known Subclasses:
    CENTRAL_LOCK, CENTRAL_LOCK2

    @Deprecated
    public abstract class Locking
    extends Protocol
    Deprecated.
    See http://belaban.blogspot.com/2020/11/i-hate-distributed-locks.html.
    Base locking protocol, handling most of the protocol communication with other instances. To use distributed locking, LockService is placed on a channel. LockService talks to a subclass of Locking via events.
    Since:
    2.12
    Author:
    Bela Ban
    See Also:
    CENTRAL_LOCK, CENTRAL_LOCK2
    • Field Detail

      • bypass_bundling

        protected boolean bypass_bundling
        Deprecated.
      • lock_striping_size

        protected int lock_striping_size
        Deprecated.
      • use_thread_id_for_lock_owner

        protected boolean use_thread_id_for_lock_owner
        Deprecated.
      • view

        protected View view
        Deprecated.
      • server_locks

        protected final java.util.concurrent.ConcurrentMap<java.lang.String,​Locking.ServerLock> server_locks
        Deprecated.
      • lock_stripes

        protected java.util.concurrent.locks.Lock[] lock_stripes
        Deprecated.
      • lock_listeners

        protected final java.util.Set<LockNotification> lock_listeners
        Deprecated.
      • current_lock_id

        protected static final java.util.concurrent.atomic.AtomicInteger current_lock_id
        Deprecated.
    • Constructor Detail

      • Locking

        public Locking()
        Deprecated.
    • Method Detail

      • bypassBundling

        public boolean bypassBundling()
        Deprecated.
      • bypassBundling

        public Locking bypassBundling​(boolean b)
        Deprecated.
      • getLockStripingSize

        public int getLockStripingSize()
        Deprecated.
      • setLockStripingSize

        public Locking setLockStripingSize​(int l)
        Deprecated.
      • useThreadIdForLockOwner

        public boolean useThreadIdForLockOwner()
        Deprecated.
      • useThreadIdForLockOwner

        public Locking useThreadIdForLockOwner​(boolean u)
        Deprecated.
      • addLockListener

        public void addLockListener​(LockNotification listener)
        Deprecated.
      • removeLockListener

        public void removeLockListener​(LockNotification listener)
        Deprecated.
      • getView

        public java.lang.String getView()
        Deprecated.
      • getNumServerLocks

        public int getNumServerLocks()
        Deprecated.
      • getNumClientLocks

        public int getNumClientLocks()
        Deprecated.
      • init

        public void init()
                  throws java.lang.Exception
        Deprecated.
        Description copied from class: Protocol
        Called after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.
        Specified by:
        init in interface Lifecycle
        Overrides:
        init in class Protocol
        Throws:
        java.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the the channel constructor will throw an exception
      • down

        public java.lang.Object down​(Event evt)
        Deprecated.
        Description copied from class: Protocol
        An event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack using down_prot.down().
        Overrides:
        down in class Protocol
      • up

        public java.lang.Object up​(Event evt)
        Deprecated.
        Description copied from class: Protocol
        An event was received from the protocol below. Usually the current protocol will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally, the event is either a) discarded, or b) an event is sent down the stack using down_prot.down() or c) the event (or another event) is sent up the stack using up_prot.up().
        Overrides:
        up in class Protocol
      • up

        public java.lang.Object up​(Message msg)
        Deprecated.
        Description copied from class: Protocol
        A single message was received. Protocols may examine the message and do something (e.g. add a header) with it before passing it up.
        Overrides:
        up in class Protocol
      • requestReceived

        protected void requestReceived​(Locking.Request req)
        Deprecated.
      • handleRequest

        protected void handleRequest​(Locking.Request req)
        Deprecated.
      • getLock

        protected Locking.ClientLock getLock​(java.lang.String name,
                                             boolean create_if_absent)
        Deprecated.
      • unlockAll

        public void unlockAll()
        Deprecated.
      • unlockForce

        public void unlockForce​(java.lang.String lock_name)
        Deprecated.
      • printLocks

        public java.lang.String printLocks()
        Deprecated.
      • printServerLocks

        public java.lang.Object printServerLocks()
        Deprecated.
      • handleView

        protected void handleView​(View view)
        Deprecated.
      • _getLock

        protected java.util.concurrent.locks.Lock _getLock​(java.lang.String lock_name)
        Deprecated.
        Gets a lock from locks based on the hash of the lock name
      • getOwner

        protected Owner getOwner()
        Deprecated.
      • sendGrantLockRequest

        protected abstract void sendGrantLockRequest​(java.lang.String lock_name,
                                                     int lock_id,
                                                     Owner owner,
                                                     long timeout,
                                                     boolean is_trylock)
        Deprecated.
      • sendReleaseLockRequest

        protected abstract void sendReleaseLockRequest​(java.lang.String lock_name,
                                                       int lock_id,
                                                       Owner owner)
        Deprecated.
      • sendAwaitConditionRequest

        protected abstract void sendAwaitConditionRequest​(java.lang.String lock_name,
                                                          Owner owner)
        Deprecated.
      • sendSignalConditionRequest

        protected abstract void sendSignalConditionRequest​(java.lang.String lock_name,
                                                           boolean all)
        Deprecated.
      • sendDeleteAwaitConditionRequest

        protected abstract void sendDeleteAwaitConditionRequest​(java.lang.String lock_name,
                                                                Owner owner)
        Deprecated.
      • sendRequest

        protected void sendRequest​(Address dest,
                                   Locking.Type type,
                                   java.lang.String lock_name,
                                   Owner owner,
                                   long timeout,
                                   boolean is_trylock)
        Deprecated.
      • sendRequest

        protected void sendRequest​(Address dest,
                                   Locking.Type type,
                                   java.lang.String lock_name,
                                   int lock_id,
                                   Owner owner,
                                   long timeout,
                                   boolean is_trylock)
        Deprecated.
      • sendLockResponse

        protected void sendLockResponse​(Locking.Type type,
                                        Owner dest,
                                        java.lang.String lock_name,
                                        int lock_id)
        Deprecated.
      • sendSignalResponse

        protected void sendSignalResponse​(Owner dest,
                                          java.lang.String lock_name)
        Deprecated.
      • handleLockRequest

        protected void handleLockRequest​(Locking.Request req)
        Deprecated.
      • handleLockGrantedResponse

        protected void handleLockGrantedResponse​(java.lang.String lock_name,
                                                 int lock_id,
                                                 Owner owner)
        Deprecated.
      • handleLockReleasedResponse

        protected void handleLockReleasedResponse​(java.lang.String lock_name,
                                                  int lock_id,
                                                  Owner owner)
        Deprecated.
      • handleLockDeniedResponse

        protected void handleLockDeniedResponse​(java.lang.String lock_name,
                                                int lock_id,
                                                Owner owner)
        Deprecated.
      • handleLockInfoRequest

        protected void handleLockInfoRequest​(Address requester)
        Deprecated.
      • handleLockInfoResponse

        protected void handleLockInfoResponse​(Address sender,
                                              Locking.Request rsp)
        Deprecated.
      • handleLockRevoked

        protected void handleLockRevoked​(Locking.Request rsp)
        Deprecated.
      • handleAwaitRequest

        protected void handleAwaitRequest​(java.lang.String lock_name,
                                          Owner owner)
        Deprecated.
      • handleDeleteAwaitRequest

        protected void handleDeleteAwaitRequest​(java.lang.String lock_name,
                                                Owner owner)
        Deprecated.
      • handleSignalResponse

        protected void handleSignalResponse​(java.lang.String lock_name,
                                            Owner owner)
        Deprecated.
      • handleSignalRequest

        protected void handleSignalRequest​(Locking.Request req)
        Deprecated.
      • handleCreateLockRequest

        protected void handleCreateLockRequest​(java.lang.String lock_name,
                                               Owner owner)
        Deprecated.
      • handleDeleteLockRequest

        protected void handleDeleteLockRequest​(java.lang.String lock_name)
        Deprecated.
      • handleCreateAwaitingRequest

        protected void handleCreateAwaitingRequest​(java.lang.String lock_name,
                                                   Owner owner)
        Deprecated.
      • handleDeleteAwaitingRequest

        protected void handleDeleteAwaitingRequest​(java.lang.String lock_name,
                                                   Owner owner)
        Deprecated.
      • notifyLockCreated

        protected void notifyLockCreated​(java.lang.String lock_name)
        Deprecated.
      • notifyLockDeleted

        protected void notifyLockDeleted​(java.lang.String lock_name)
        Deprecated.
      • notifyLockRevoked

        protected void notifyLockRevoked​(java.lang.String lock_name,
                                         Owner current_owner)
        Deprecated.
      • notifyLocked

        protected void notifyLocked​(java.lang.String lock_name,
                                    Owner owner)
        Deprecated.
      • notifyUnlocked

        protected void notifyUnlocked​(java.lang.String lock_name,
                                      Owner owner)
        Deprecated.
      • notifyAwaiting

        protected void notifyAwaiting​(java.lang.String lock_name,
                                      Owner owner)
        Deprecated.
      • notifyAwaited

        protected void notifyAwaited​(java.lang.String lock_name,
                                     Owner owner)
        Deprecated.