com.ibm.as400.access

Class ClusteredHashTableEntry

  • java.lang.Object
    • com.ibm.as400.access.ClusteredHashTableEntry
  • All Implemented Interfaces:
    java.io.Serializable


    public class ClusteredHashTableEntry
    extends java.lang.Object
    implements java.io.Serializable
    The ClusteredHashTableEntry class represents an entry in an IBM i highly available Clustered Hash Table. This class is only intended to be used with the ClusteredHashTable class.

    Note: This class uses APIs that are available only when connecting to systems running OS/400 V5R2M0 or later.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int DUPLICATE_KEY_FAIL
      Update option to indicate if the specified key already exists then do not allow the ClusteredHashTable.put() request to succeed.
      static int DUPLICATE_KEY_UPDATE
      Update option to indicate if the specified key already exists then allow the entry to be updated on the ClusteredHashTable.put() request.
      static int ENTRY_AUTHORITY_ANY_USER
      Entry authority option that identifies any user can access the entry in the clustered hash table.
      static int ENTRY_AUTHORITY_LAST_USER
      Entry authority option that identifies a user with *ALLOBJ authority, the user that owns the entry or both can access it.
      static int ENTRY_STATUS_CONSISTENT
      Data is consistent across the clustered hash table domain.
      static int ENTRY_STATUS_INCONSISTENT
      Data is not consistent across the clustered hash table domain.
      static int MAX_USER_DATA_LENGTH
      Maximum amount of user data that can be stored in a clustered hash table entry.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ClusteredHashTableEntry()
      Constructs a default ClusteredHashTableEntry object.
      ClusteredHashTableEntry(byte[] key, byte[] userData, int timeToLive, int entryAuthority, int updateOption)
      Constructs a ClusteredHashTableEntry object that represents an entry in the clustered hash table.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
      Adds a listener to be notified when the value of any bound property is changed.
      int getEntryAuthority()
      Returns the entry authority.
      int getEntryStatus()
      Returns the entry status.
      byte[] getKey()
      Returns the key.
      java.lang.String getModifiedProfile()
      Returns the user profile that last modified the entry.
      java.lang.String getOwnerProfile()
      Returns the user profile that created the entry.
      int getTimeToLive()
      Returns the time to live (in seconds) that was passed to the constructor.
      int getUpdateOption()
      Returns the update option that was passed to the constructor.
      byte[] getUserData()
      Returns the user data.
      void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
      Removes the listener from being notified when a bound property changes.
      void setEntryAuthority(int entryAuthority)
      Sets the entry authority.
      protected void setEntryStatus(int entryStatus)
      Sets the entry status for the entry.
      void setKey(byte[] key)
      Sets the key.
      protected void setModifiedProfile(java.lang.String usr)
      Sets the user profile that modified the entry.
      protected void setOwnerProfile(java.lang.String usr)
      Sets the user profile that created the entry.
      void setTimeToLive(int timeToLive)
      Sets the time to live (in seconds) an entry remains in the clustered hash table.
      void setUpdateOption(int updateOption)
      Sets the update option.
      void setUserData(byte[] userData)
      Sets the user data to be stored in the clustered hash table.
      • Methods inherited from class java.lang.Object

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

      • ENTRY_AUTHORITY_ANY_USER

        public static final int ENTRY_AUTHORITY_ANY_USER
        Entry authority option that identifies any user can access the entry in the clustered hash table.
        See Also:
        Constant Field Values
      • ENTRY_AUTHORITY_LAST_USER

        public static final int ENTRY_AUTHORITY_LAST_USER
        Entry authority option that identifies a user with *ALLOBJ authority, the user that owns the entry or both can access it.
        See Also:
        Constant Field Values
      • DUPLICATE_KEY_UPDATE

        public static final int DUPLICATE_KEY_UPDATE
        Update option to indicate if the specified key already exists then allow the entry to be updated on the ClusteredHashTable.put() request.
        See Also:
        Constant Field Values
      • DUPLICATE_KEY_FAIL

        public static final int DUPLICATE_KEY_FAIL
        Update option to indicate if the specified key already exists then do not allow the ClusteredHashTable.put() request to succeed.
        See Also:
        Constant Field Values
      • ENTRY_STATUS_CONSISTENT

        public static final int ENTRY_STATUS_CONSISTENT
        Data is consistent across the clustered hash table domain.
        See Also:
        Constant Field Values
      • ENTRY_STATUS_INCONSISTENT

        public static final int ENTRY_STATUS_INCONSISTENT
        Data is not consistent across the clustered hash table domain.
        See Also:
        Constant Field Values
      • MAX_USER_DATA_LENGTH

        public static final int MAX_USER_DATA_LENGTH
        Maximum amount of user data that can be stored in a clustered hash table entry.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ClusteredHashTableEntry

        public ClusteredHashTableEntry()
        Constructs a default ClusteredHashTableEntry object. The key and data must be set prior to invoking the ClusteredHashTable.put() method.
      • ClusteredHashTableEntry

        public ClusteredHashTableEntry(byte[] key,
                               byte[] userData,
                               int timeToLive,
                               int entryAuthority,
                               int updateOption)
        Constructs a ClusteredHashTableEntry object that represents an entry in the clustered hash table.
        Parameters:
        key - The key that identifies the entry. The ClusteredHashTable.generateKey() method can be used to provide a unique key.
        userData - The user data to be stored in the clustered hash table. The length of this data must be 1 through MAX_USER_DATA_LENGTH (61000 bytes).
        timeToLive - The time (in seconds) that the entry will be allowed to remain in the clustered hash table. If the value is -1, the entry will never expire. The value must be -1, greater than or equal to 60 seconds, and less than the seconds in 1 year (31,536,000). This value will be truncated to the nearest minute.
        entryAuthority - This field identifies who is allowed to access, for example update and retrieve, the entry associated with the key. This value must be ENTRY_AUTHORITY_LAST_USER if the current cluster version is 2. Valid values are:
        • ENTRY_AUTHORITY_LAST_USER = The user who requests the ClusteredHashTable.put(), a user with *ALLOBJ authority or both is allowed to access the entry.
        • ENTRY_AUTHORITY_ANY_USER = Any user can access the entry.
        updateOption - This is the action used on a ClusteredHashTable.put() request when the key specified on the constructor or set using setKey() already exists in the clustered hash table. This value must be DUPLICATE_KEY_FAIL if the current cluster version is 2. It is only valid for the duration of the ClusteredHashTable.put() request. Valid values are:
        • DUPLICATE_KEY_FAIL = Do not allow the ClusteredHashTable.put() if the key already exists.
        • DUPLICATE_KEY_UPDATE = Allow the entry associated with the key to be updated if it already exists in the clustered hash table and the requesting user is authorized to the data.
    >
    • Method Detail

      • getEntryStatus

        public int getEntryStatus()
        Returns the entry status. Valid values are:
        • ENTRY_STATUS_CONSISTENT = The entry is consistent between the clustered hash table domain.
        • ENTRY_STATUS_INCONSISTENT = The entry is not consistent between the clustered hash table domain.
        Returns:
        The entry status.
      • getEntryAuthority

        public int getEntryAuthority()
        Returns the entry authority. This field identifies who is allowed to access, for example update and retrieve, the entry associated with the key. Valid values are:
        • ENTRY_AUTHORITY_LAST_USER = The user who owns the entry, users with *ALLOBJ authority, or both are allowed to access the entry.
        • ENTRY_AUTHORITY_ANY_USER = Any user can access the entry.
        Returns:
        The entry authority. The default value is ENTRY_AUTHORITY_LAST_USER.
      • getKey

        public byte[] getKey()
        Returns the key.
        Returns:
        A byte array copy of the key, or null if the key is not set.
      • getTimeToLive

        public int getTimeToLive()
        Returns the time to live (in seconds) that was passed to the constructor. This value cannot be retrieved from the hash table. The only purpose of this method is to see what the user passed into the ClusteredHashTableEntry. If no value was specified in the constructor, this will return the defaulted value.
        Returns:
        The time to live. The default is 60 seconds.
      • getUpdateOption

        public int getUpdateOption()
        Returns the update option that was passed to the constructor. This value cannot be retrieved from the hash table. The only purpose of this method is to see what the user passed into the ClusteredHashTableEntry. If no value was specified in the constructor, this will return the defaulted value.
        Returns:
        The update option. The default is DUPLICATE_KEY_FAIL.
      • getUserData

        public byte[] getUserData()
        Returns the user data.
        Returns:
        A byte array copy of the user data, or null if the user data is not set.
      • getOwnerProfile

        public java.lang.String getOwnerProfile()
        Returns the user profile that created the entry.
        Returns:
        The user profile that created the entry.
      • setOwnerProfile

        protected void setOwnerProfile(java.lang.String usr)
        Sets the user profile that created the entry.
        Parameters:
        usr - The user that created the entry.
      • getModifiedProfile

        public java.lang.String getModifiedProfile()
        Returns the user profile that last modified the entry.
        Returns:
        The user profile that last modified the entry.
      • setModifiedProfile

        protected void setModifiedProfile(java.lang.String usr)
        Sets the user profile that modified the entry.
        Parameters:
        usr - The user that modified the entry.
      • removePropertyChangeListener

        public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
        Removes the listener from being notified when a bound property changes.
        Parameters:
        listener - The PropertyChangeListener.
        See Also:
        addPropertyChangeListener(java.beans.PropertyChangeListener)
      • setEntryAuthority

        public void setEntryAuthority(int entryAuthority)
        Sets the entry authority. This identifies who is allowed to access, for example update and retrieve, the entry associated with the key. This value must be ENTRY_AUTHORITY_LAST_USER if the current cluster version is 2. Valid values are:
        • ENTRY_AUTHORITY_LAST_USER = The user who requests the ClusteredHashTable.put(), a user with *ALLOBJ authority or both is allowed to access the entry.
        • ENTRY_AUTHORITY_ANY_USER = Any user can access the entry.
        Parameters:
        entryAuthority - The value of the entry authority. The default for this parameter is ENTRY_AUTHORITY_LAST_USER.
      • setKey

        public void setKey(byte[] key)
        Sets the key. The ClusteredHashTable.generateKey() method can be used to generate the key. Clustered hash table keys must be 16 bytes. The key must be set before invoking the ClusteredHashTable.put() method.
        Parameters:
        key - The key.
      • setEntryStatus

        protected void setEntryStatus(int entryStatus)
        Sets the entry status for the entry. Can only be ENTRY_STATUS_CONSISTENT or ENTRY_STATUS_INCONSISTENT. ENTRY_STATUS_CONSISTENT means consistent in the Cluster Hash Table. ENTRY_STATUS_INCONSISTENT means it is inconstistent or the entry is not the same on all nodes in the clustered hash table domain.
        Parameters:
        entryStatus - the status of the entry.
      • setTimeToLive

        public void setTimeToLive(int timeToLive)
        Sets the time to live (in seconds) an entry remains in the clustered hash table. This value must be greater than or equal to 60 seconds. The time out will be truncated to the nearest minute. If the value is -1, the entry will never expire.
        Parameters:
        timeToLive - The value of the time to live. The default for the timeToLive is 60 seconds.
      • setUpdateOption

        public void setUpdateOption(int updateOption)
        Sets the update option. This is the action used by ClusteredHashTable.put() when the specified key already exists in the clustered hash table. This value must be DUPLICATE_KEY_FAIL if the current cluster version is 2. It is only valid for the duration of the ClusteredHashTable.put() method. Valid values are:
        • DUPLICATE_KEY_FAIL = Do not allow the ClusteredHashTable.put() to succeed if the key already exists.
        • DUPLICATE_KEY_UPDATE = Allow the entry associated with the key to be updated if it already exists in the clustered hash table.
        Parameters:
        updateOption - The value of the update option.
      • setUserData

        public void setUserData(byte[] userData)
        Sets the user data to be stored in the clustered hash table. The length of the data must be 1 through MAX_USER_DATA_LENGTH. The user data must be set before invoking the ClusteredHashTable.put() method.
        Parameters:
        userData - The user data.