Class ContainerLock


  • public final class ContainerLock
    extends java.lang.Object
    A ContainerLock represents a qualifier that is to be used when locking a container through a ContainerHandle.
    MT - Immutable
    See Also:
    ContainerHandle, LockingPolicy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static boolean[][] C_COMPAT
      Container lock compatibility table.
      static int C_NUMBER
      Number of types of container locks.
      static ContainerLock CIS
      Container Intent Shared lock
      static ContainerLock CIX
      Container Intent Exclusive lock
      private int compat
      Bit mask which represents the lock types that are compatible with this lock type.
      static ContainerLock CS
      Container Shared lock
      static ContainerLock CU
      Container Update lock
      static ContainerLock CX
      Container Exclusive lock
      private static java.lang.String[] shortnames  
      private int type
      Integer representation of the type of the lock.
      private int typeBit
      Bit mask with one bit set.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ContainerLock​(int type)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getType()
      Get an integer representation of the type of the lock.
      boolean isCompatible​(ContainerLock granted)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • type

        private final int type
        Integer representation of the type of the lock.
      • typeBit

        private final int typeBit
        Bit mask with one bit set. The position of the bit tells the type of the lock.
      • compat

        private final int compat
        Bit mask which represents the lock types that are compatible with this lock type.
      • C_NUMBER

        public static final int C_NUMBER
        Number of types of container locks.
        See Also:
        Constant Field Values
      • C_COMPAT

        private static final boolean[][] C_COMPAT
        Container lock compatibility table.
      • shortnames

        private static java.lang.String[] shortnames
      • CIS

        public static final ContainerLock CIS
        Container Intent Shared lock
      • CIX

        public static final ContainerLock CIX
        Container Intent Exclusive lock
      • CX

        public static final ContainerLock CX
        Container Exclusive lock
    • Constructor Detail

      • ContainerLock

        private ContainerLock​(int type)
    • Method Detail

      • getType

        public int getType()
        Get an integer representation of the type of the lock. This method is guaranteed to return an integer >= 0 and &t; C_NUMBER. No correlation between the value and one of the static variables (CIS etc.) is guaranteed, except that the values returned do not change.
      • isCompatible

        public boolean isCompatible​(ContainerLock granted)
      • toString

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