com.streambase.sb.operator

## Interface Operator.SharedObjectManager

- Enclosing class:
    Operator

      public static interface Operator.SharedObjectManager

  The manager for SharedObjects within a container. Used in the `Operator.RuntimeEnvironment` interface to manage SharedObjects. The lifecycle of a registered SharedObject is maintained by the parent Container. When the parent Container is removed, suspended, resumed the appropriate methods on the SharedObject will also be called. SharedObjects are maintained by the key given during `Operator.SharedObjectManager.registerSharedObject(java.lang.Object, com.streambase.sb.operator.Operator.SharedObject)`.
  Since:
    7.1 initial release

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Operator.SharedObject` | `getSharedObject(Object key)` get the SharedObject from this Container.
    `Operator.SharedObject.State` | `getSharedObjectState(Object key)` Return the `Operator.SharedObject.State` of SharedObject on this Container associated with the given key or null if there was no mapping
    `void` | `registerSharedObject(Object key, Operator.SharedObject value)` Add the given SharedObject to this Container.
    `Operator.SharedObject` | `removeSharedObject(Object key)` Remove the SharedObject from this Container.

- - ### Method Detail

    - #### registerSharedObject

          void registerSharedObject(Object key,
                                    Operator.SharedObject value)
                             throws AlreadyRegisteredException,
                                    StreamBaseException

      Add the given SharedObject to this Container. Once the SharedObject is added, the Container will be responsible for management of the state of the object. The SharedObject.start() method will be called if the container has been started.
      Parameters:
        `key` - The key that the SharedObjectManager uses to maintain the SharedObject
        `value` - the SharedObject
      Throws:
        `IllegalArgumentException` - if there has already been a SharedObject registered with the given key
        `AlreadyRegisteredException` - throw if the SharedObject is already registered
        `StreamBaseException` - thrown by calling the SharedObject.start()
      See Also:
        `Operator.SharedObject`

    - #### getSharedObject

          Operator.SharedObject getSharedObject(Object key)

      get the SharedObject from this Container.
      Parameters:
        `key` - Object key
      Returns:
        the SharedObject associated with this key on this Container or null if there was no mapping
      See Also:
        `Operator.SharedObject`

    - #### removeSharedObject

          Operator.SharedObject removeSharedObject(Object key)

      Remove the SharedObject from this Container. Once removed from this Container the user is responsible for state management of the SharedObject.
      Parameters:
        `key` - Object key
      Returns:
        the SharedObject associated with this key on this Container or null if there was no mapping
      See Also:
        `Operator.SharedObject`

    - #### getSharedObjectState

          Operator.SharedObject.State getSharedObjectState(Object key)

      Return the `Operator.SharedObject.State` of SharedObject on this Container associated with the given key or null if there was no mapping
      Parameters:
        `key` - the key for the SharedObject for this Container
      Returns:
        The State for the given SharedObject
      See Also:
        `Operator.SharedObject`

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.