com.ibm.broker.plugin

Class MbGlobalMap

  • java.lang.Object
    • com.ibm.broker.plugin.MbGlobalMap


  • public class MbGlobalMap
    extends java.lang.Object
    MbGlobalMap represents an instance of a map within the embedded global cache, or in an external WebSphere eXtreme Scale grid. An MbGlobalMap is ideal for sharing data across multiple execution groups or brokers.
    Please see the product documentation for more information on using and administering the global cached embedded within the broker.

    An MbGlobalMap can be obtained by using the getGlobalMap static method in MbGlobalMap.

    The underlying data within the cache will exist until it is removed from the cache, the timeToLive of the associated MbGlobalMapSessionPolicy (if specified) has elapsed, or until the cache is shut down.

    Changes made to an MbGlobalMap object will be visible to all other clients when they access the same map. The timing of this visibility depends on the detailed configuration of the cache, and the transactional properties. By default, all actions on the Map are committed immediately.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean containsKey(java.lang.Object key)
      Returns true if the specified key exists in this map.
      java.lang.Object get(java.lang.Object key)
      Gets the value associated with the specified key from this map.
      java.lang.String getConfigurableService()
      Get the name of the configurable service used by this map.
      static MbGlobalMap getGlobalMap()
      Gets the default global map from the global cache within this broker.
      static MbGlobalMap getGlobalMap(java.lang.String mapName)
      Gets a global map of the given name from the global cache within this broker.
      static MbGlobalMap getGlobalMap(java.lang.String mapName, MbGlobalMapSessionPolicy sessionPolicy)
      Gets a global map of the given name from the global cache within this broker.
      static MbGlobalMap getGlobalMap(java.lang.String mapName, java.lang.String configurableService)
      Gets a global map of the given name from an external WebSphere eXtreme Scale grid.
      java.lang.String getGridName()
      Get the name of the grid behind this map.
      java.lang.String getMapName()
      Get the name of this map.
      java.lang.Object put(java.lang.Object key, java.lang.Object value)
      Puts the specified key/value pair into this map.
      void putAll(java.util.Map m)
      Puts all the entries in the supplied Map into this map.
      java.lang.Object remove(java.lang.Object key)
      Removes the key (and associated value) from this map.
      void update(java.lang.Object key, java.lang.Object value)
      Updates the value associated with the specified key, to the value supplied.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getGlobalMap

        public static MbGlobalMap getGlobalMap()
                                        throws MbException
        Gets the default global map from the global cache within this broker. This method will implicitly create a connection to the global cache, if one does not already exist for this session.

        The underlying data within the cache will exist until it is removed from the cache, or the cache is shut down.
        This method is a static 'factory' style getter, it does not return a singleton instance of MbGlobalMap.
        Returns:
        MbGlobalMap
        Throws:
        MbException
      • getGlobalMap

        public static MbGlobalMap getGlobalMap(java.lang.String mapName)
                                        throws MbException
        Gets a global map of the given name from the global cache within this broker. This method will implicitly create a connection to the global cache, if one does not already exist for this session.

        The underlying data within the cache will exist until it is removed from the cache, or the cache is shut down.

        If the specified map name does not exist, it is automatically created.
        This method is a static 'factory' style getter, it does not return a singleton instance of MbGlobalMap.

        Map names beginning with the prefix "SYSTEM.BROKER" are reserved for use by the broker, any attempt to get a map beginning with this prefix will fail, apart from the default map, which is named "SYSTEM.BROKER.DEFAULTMAP".
        Parameters:
        mapName - Name of the map to be returned from the cache
        Returns:
        MbGlobalMap
        Throws:
        MbException
      • getGlobalMap

        public static MbGlobalMap getGlobalMap(java.lang.String mapName,
                                               MbGlobalMapSessionPolicy sessionPolicy)
                                        throws MbException
        Gets a global map of the given name from the global cache within this broker. This method will implicitly create a connection to the global cache, if one does not already exist for this session.

        Some properties of the data created or updated by this map will be governed by the MbGlobalMapSessionPolicy object. If the timeToLive property of that object is set, and is greater than zero, then cache entries created by this MbGlobalMap object will automatically be evicted from the cache when this period of time (since the last update of that data) has elapsed.
        If the specified map name does not exist, it is automatically created.
        This method is a static 'factory' style getter, it does not return a singleton instance of MbGlobalMap.

        Map names beginning with the prefix "SYSTEM.BROKER" are reserved for use by the broker, any attempt to get a map beginning with this prefix will fail, apart from the default map, which is named "SYSTEM.BROKER.DEFAULTMAP".
        Parameters:
        mapName - Name of the map to be returned from the cache
        sessionPolicy - A MbGlobalMapSessionPolicy object, containing properties to be overridden
        Returns:
        MbGlobalMap
        Throws:
        MbException
      • getGlobalMap

        public static MbGlobalMap getGlobalMap(java.lang.String mapName,
                                               java.lang.String configurableService)
                                        throws MbException
        Gets a global map of the given name from an external WebSphere eXtreme Scale grid. This method will implicitly create a connection to the grid, if one does not already exist for this session.

        The map name specified must be a valid map name for the remote grid.
        This method is a static 'factory' style getter, it does not return a singleton instance of MbGlobalMap.
        Parameters:
        mapName - Name of the map to be returned from the cache
        configurableService - Name of the configurable service that defines how a connection to the external WebSphere eXtreme Scale grid should be established.
        Returns:
        MbGlobalMap
        Throws:
        MbException
      • containsKey

        public boolean containsKey(java.lang.Object key)
                            throws MbException
        Returns true if the specified key exists in this map.
        Parameters:
        key - The key to look up in this map
        Returns:
        boolean True if the key exists, otherwise false
        Throws:
        MbException
      • get

        public java.lang.Object get(java.lang.Object key)
                             throws MbException
        Gets the value associated with the specified key from this map.
        If the key does not exist, returns null.
        Parameters:
        key - The key to look up in this map
        Returns:
        Object the value associated with the key
        Throws:
        MbException
      • put

        public java.lang.Object put(java.lang.Object key,
                                    java.lang.Object value)
                             throws MbException
        Puts the specified key/value pair into this map.
        Fails if the key already exists within this map.
        Parameters:
        key - The key to put into the map. This must be a Java primitive type or a String.
        value - The value associated with the key. This must be a Java primitive type or a String.
        Returns:
        Object The previous value associated with the key in the map, which will always be null.
        Throws:
        MbException
      • putAll

        public void putAll(java.util.Map m)
                    throws MbException
        Puts all the entries in the supplied Map into this map.
        Parameters:
        m - Map to put into this map
        Throws:
        MbException
      • remove

        public java.lang.Object remove(java.lang.Object key)
                                throws MbException
        Removes the key (and associated value) from this map.
        Parameters:
        key - Key to remove from this map
        Returns:
        Object The current value at invocation time
        Throws:
        MbException
      • update

        public void update(java.lang.Object key,
                           java.lang.Object value)
                    throws MbException
        Updates the value associated with the specified key, to the value supplied.
        Fails if the specified key is not present in the map.
        Parameters:
        key - Key for which the value is to be updated. This must be a Java primitive type or a String.
        value - New value for the key. This must be a Java primitive type or a String.
        Throws:
        MbException
      • getMapName

        public java.lang.String getMapName()
        Get the name of this map.
        Returns:
        Map name
      • getConfigurableService

        public java.lang.String getConfigurableService()
        Get the name of the configurable service used by this map. May be empty if no configurable service was specified.
        Returns:
        Configurable service name
      • getGridName

        public java.lang.String getGridName()
        Get the name of the grid behind this map.
        Returns:
        Grid name
IBM Integration BusTM
JavaTM Plugin Node API