Class ContainerKey

  • All Implemented Interfaces:
    Lockable, Matchable

    public final class ContainerKey
    extends java.lang.Object
    implements Matchable, Lockable
    A key that identifies a Container within the RawStore.
    MT - Immutable
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long containerId  
      private long segmentId  
    • Constructor Summary

      Constructors 
      Constructor Description
      ContainerKey​(long segmentId, long containerId)
      Create a new ContainerKey
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)  
      long getContainerId()
      Return my identifier within the segment
      long getSegmentId()
      Return my segment identifier
      int hashCode()  
      boolean lockAttributes​(int flag, java.util.Hashtable<java.lang.String,​java.lang.Object> attributes)
      This lockable wants to participate in the Virtual Lock table.
      boolean lockerAlwaysCompatible()
      This method will only be called if requestCompatible returned false.
      void lockEvent​(Latch lockInfo)
      Note the fact the object is locked.
      boolean match​(java.lang.Object key)
      Return true if the passed in object matches this object.
      static ContainerKey read​(java.io.ObjectInput in)  
      boolean requestCompatible​(java.lang.Object requestedQualifier, java.lang.Object grantedQualifier)
      Return true if the requested qualifier is compatible with the already granted qualifier.
      java.lang.String toString()  
      void unlockEvent​(Latch lockInfo)
      Note that the object has been unlocked
      void writeExternal​(java.io.ObjectOutput out)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • segmentId

        private final long segmentId
      • containerId

        private final long containerId
    • Constructor Detail

      • ContainerKey

        public ContainerKey​(long segmentId,
                            long containerId)
        Create a new ContainerKey
    • Method Detail

      • getContainerId

        public long getContainerId()
        Return my identifier within the segment
      • getSegmentId

        public long getSegmentId()
        Return my segment identifier
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static ContainerKey read​(java.io.ObjectInput in)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • match

        public boolean match​(java.lang.Object key)
        Description copied from interface: Matchable
        Return true if the passed in object matches this object.
        Specified by:
        match in interface Matchable
      • lockEvent

        public void lockEvent​(Latch lockInfo)
        Description copied from interface: Lockable
        Note the fact the object is locked. Performs required actions to ensure that unlockEvent() work correctly. This method does not actually perform any locking of the object, the locking mechanism is provided by the lock manager.

        If the class supports multiple lockers of the object then this method will be called once per locker, each with their own qualifier.

        Must only be called by the lock manager. Synchronization will be handled by the lock manager.

        Specified by:
        lockEvent in interface Lockable
      • requestCompatible

        public boolean requestCompatible​(java.lang.Object requestedQualifier,
                                         java.lang.Object grantedQualifier)
        Description copied from interface: Lockable
        Return true if the requested qualifier is compatible with the already granted qualifier.
        Specified by:
        requestCompatible in interface Lockable
      • lockerAlwaysCompatible

        public boolean lockerAlwaysCompatible()
        This method will only be called if requestCompatible returned false. This results from two cases, some other compatabilty space has some lock that would conflict with the request, or this compatability space has a lock tha
        Specified by:
        lockerAlwaysCompatible in interface Lockable
      • unlockEvent

        public void unlockEvent​(Latch lockInfo)
        Description copied from interface: Lockable
        Note that the object has been unlocked

        Must only be called by the lock manager. Synchronization will be handled by the lock manager.

        Specified by:
        unlockEvent in interface Lockable
      • lockAttributes

        public boolean lockAttributes​(int flag,
                                      java.util.Hashtable<java.lang.String,​java.lang.Object> attributes)
        This lockable wants to participate in the Virtual Lock table.
        Specified by:
        lockAttributes in interface Lockable
        Parameters:
        flag - use the bits in this int to decide if the user is interested in this kind of lockable object. The bits are defined in VirtualLockTable. For instance, the user may only ask for TABLE_AND_ROWLOCK and if this is not a table or row lock, then don't participate.
        attributes - if this decides to participate, put all relevant attributes into the Hashtable. The complete list of interesting attributes is listed in VirtualLockTable. The following attributes must be present for all participating lockables: VirtualLockTable.LOCKNAME, VirtualLockTable.LOCKTYPE, either VirtualLockTable.CONTAINERID or VirtualLockTable.CONGLOMID,

        MT - this routine must be MP safe, caller will not be single threading the lock manager.

        Returns:
        true if this object has diagnostic information to add to the virtual lock table. If this object either does not want to participate in the diagnostic virtual lock table or none of the attributes requested are attributes of this lock, returns false.
        See Also:
        VirtualLockTable