Package org.red5.server.api.so
Interface ISharedObjectBase
- All Superinterfaces:
AttributeStoreMXBean,IAttributeStore,ICastingAttributeStore,IServiceHandlerProvider,ISharedObjectHandlerProvider
- All Known Subinterfaces:
IClientSharedObject,ISharedObject
- All Known Implementing Classes:
ClientSharedObject,SharedObjectScope
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 Summary
Modifier and TypeMethodDescriptionvoidaddSharedObjectListener(ISharedObjectListener listener) Register object that will be notified about update events.voidStart performing multiple updates to the shared object from serverside code.voidbeginUpdate(IEventListener source) Start performing multiple updates to the shared object from a connected client.booleanclear()Deletes all the attributes and sends a clear event to all listeners.voidclose()Detaches a reference from this shared object, this will destroy the reference immediately.voidThe multiple updates are complete, notify clients about all changes at once.getData()Return a map containing all attributes of the shared object.intReturns the version of the shared object.booleanCheck if the object has been created as persistent shared object by the client.voidUnregister object to not longer receive update events.voidsendMessage(String handler, List<?> arguments) Send a message to a handler of the shared object.Methods inherited from interface org.red5.server.api.IAttributeStore
getAttribute, getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, hasAttribute, removeAttribute, removeAttribute, removeAttributes, setAttribute, setAttribute, setAttributes, setAttributes, sizeMethods inherited from interface org.red5.server.api.ICastingAttributeStore
getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttributeMethods inherited from interface org.red5.server.api.service.IServiceHandlerProvider
getServiceHandler, getServiceHandlerNames, registerServiceHandlerMethods inherited from interface org.red5.server.api.so.ISharedObjectHandlerProvider
registerServiceHandler, unregisterServiceHandler
-
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
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
Send a message to a handler of the shared object.- Parameters:
handler- the name of the handler to callarguments- 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
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. -
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.
-