Interface ISharedObjectBase

All Superinterfaces:
AttributeStoreMXBean, IAttributeStore, ICastingAttributeStore, IServiceHandlerProvider, ISharedObjectHandlerProvider
All Known Subinterfaces:
IClientSharedObject, ISharedObject
All Known Implementing Classes:
ClientSharedObject, SharedObjectScope

public interface ISharedObjectBase extends ISharedObjectHandlerProvider, ICastingAttributeStore
Base interface for shared objects. Changes to the shared objects are propagated to all subscribed clients. If you want to modify multiple attributes and notify the clients about all changes at once, you can use code like this:
 SharedObject.beginUpdate();
 SharedObject.setAttribute("One", '1');
 SharedObject.setAttribute("Two", '2');
 SharedObject.removeAttribute("Three");
 SharedObject.endUpdate();
 
All changes between "beginUpdate" and "endUpdate" will be sent to the clients using one notification event.
Author:
The Red5 Project, Joachim Bauch (jojo@struktur.de)
  • Method Details

    • getVersion

      int getVersion()
      Returns the version of the shared object. The version is incremented automatically on each modification.
      Returns:
      the version of the shared object
    • isPersistent

      boolean isPersistent()
      Check if the object has been created as persistent shared object by the client.
      Returns:
      true if the shared object is persistent, false otherwise
    • getData

      Map<String,Object> getData()
      Return a map containing all attributes of the shared object.
      NOTE: The returned map will be read-only.
      Returns:
      a map containing all attributes of the shared object
    • sendMessage

      void sendMessage(String handler, List<?> arguments)
      Send a message to a handler of the shared object.
      Parameters:
      handler - the name of the handler to call
      arguments - a list of objects that should be passed as arguments to the handler
    • beginUpdate

      void beginUpdate()
      Start performing multiple updates to the shared object from serverside code.
    • beginUpdate

      void beginUpdate(IEventListener source)
      Start performing multiple updates to the shared object from a connected client.
      Parameters:
      source - Update events listener
    • endUpdate

      void endUpdate()
      The multiple updates are complete, notify clients about all changes at once.
    • addSharedObjectListener

      void addSharedObjectListener(ISharedObjectListener listener)
      Register object that will be notified about update events.
      Parameters:
      listener - the object to notify
    • removeSharedObjectListener

      void removeSharedObjectListener(ISharedObjectListener listener)
      Unregister object to not longer receive update events.
      Parameters:
      listener - the object to unregister
    • clear

      boolean clear()
      Deletes all the attributes and sends a clear event to all listeners. The persistent data object is also removed from a persistent shared object.
      Returns:
      true if successful; false otherwise
    • close

      void close()
      Detaches a reference from this shared object, this will destroy the reference immediately. This is useful when you don't want to proxy a shared object any longer.