public class ClientSharedObject extends SharedObject implements IClientSharedObject, IEventDispatcher
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
acquireCount, changeStats, closed, deleteStats, lastModified, listenerStats, modified, name, ownerMessage, path, persistent, sendStats, source, storage, syncEvents, updateCounter, versionattributesTRANSIENT_PREFIXHANDSHAKE_SIZE, HEADER_CONTINUE, HEADER_NEW, HEADER_SAME_SOURCE, HEADER_TIMER_CHANGE, MEDIUM_INT_MAX, SO_CLIENT_CLEAR_DATA, SO_CLIENT_DELETE_DATA, SO_CLIENT_INITIAL_DATA, SO_CLIENT_SEND_MESSAGE, SO_CLIENT_STATUS, SO_CLIENT_UPDATE_ATTRIBUTE, SO_CLIENT_UPDATE_DATA, SO_CONNECT, SO_DELETE_ATTRIBUTE, SO_DISCONNECT, SO_SEND_MESSAGE, SO_SET_ATTRIBUTE, SOURCE_TYPE_LIVE, SOURCE_TYPE_VOD, TYPE_ABORT, TYPE_AGGREGATE, TYPE_AUDIO_DATA, TYPE_BYTES_READ, TYPE_CHUNK_SIZE, TYPE_CLIENT_BANDWIDTH, TYPE_EDGE_ORIGIN, TYPE_FLEX_MESSAGE, TYPE_FLEX_SHARED_OBJECT, TYPE_FLEX_STREAM_SEND, TYPE_INVOKE, TYPE_NOTIFY, TYPE_PING, TYPE_SERVER_BANDWIDTH, TYPE_SHARED_OBJECT, TYPE_STREAM_METADATA, TYPE_VIDEO_DATA| Constructor and Description |
|---|
ClientSharedObject(String name,
boolean persistent)
Create new client SO with
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSharedObjectListener(ISharedObjectListener listener)
Register object that will be notified about update events.
|
void |
beginUpdate()
Begin update of this Shared Object.
|
void |
beginUpdate(IEventListener listener)
Begin update of this Shared Object and setting listener
|
boolean |
clear()
Deletes all the attributes and sends a clear event to all listeners.
|
void |
close()
Detaches a reference from this shared object, reset it's state, this will destroy the reference immediately.
|
void |
connect(IConnection conn)
Connect the shared object using the passed connection.
|
void |
disconnect()
Disconnect the shared object.
|
void |
dispatchEvent(IEvent e)
Dispatches event
|
void |
endUpdate()
End update of this Shared Object.
|
Object |
getAttribute(String name,
Object defaultValue)
Return attribute by name and set if it doesn't exist yet.
|
Object |
getServiceHandler(String name)
Return a previously registered service handler.
|
Set<String> |
getServiceHandlerNames()
Get list of registered service handler names.
|
boolean |
isConnected()
Check if the shared object is connected to the server.
|
boolean |
isLocked()
Returns the locked state of this SharedObject.
|
void |
lock()
Locks the shared object instance.
|
protected void |
notifyClear()
Notify listeners on clear
|
protected void |
notifyConnect()
Notify listeners on event
|
protected void |
notifyDelete(String key)
Notify listeners on attribute delete
|
protected void |
notifyDisconnect()
Notify listeners on disconnect
|
protected void |
notifySendMessage(String method,
List<?> params)
Broadcast send event to listeners
|
protected void |
notifyUpdate(String key,
Map<String,Object> value)
Notify listeners on map attribute update
|
protected void |
notifyUpdate(String key,
Object value)
Notify listeners on update
|
void |
registerServiceHandler(Object handler)
Register an object that provides methods which handle calls without a service name to a shared object.
|
void |
registerServiceHandler(String name,
Object handler)
Register an object that provides methods which can be called from a client.
|
boolean |
removeAttribute(String name)
Removes attribute with given name
|
void |
removeAttributes()
Remove all attributes (clear Shared Object)
|
void |
removeSharedObjectListener(ISharedObjectListener listener)
Unregister object to not longer receive update events.
|
void |
sendMessage(String handler,
List<?> arguments)
Broadcast event to event handler
|
boolean |
setAttribute(String name,
Object value)
Set an attribute on this object.
|
boolean |
setAttributes(IAttributeStore values)
Set multiple attributes on this object.
|
boolean |
setAttributes(Map<String,Object> values)
Set multiple attributes on this object.
|
void |
unlock()
Unlocks a shared object instance that was locked with SharedObject.lock().
|
void |
unregisterServiceHandler(String name)
Unregister the shared object handler for calls without a service name.
|
acquire, checkRelease, deserialize, getActiveListeners, getCreationTime, getData, getLastModified, getListeners, getMaxListeners, getName, getPath, getStore, getTotalChanges, getTotalDeletes, getTotalListeners, getTotalSends, getType, getVersion, isAcquired, isClosed, isPersistent, notifyModified, register, release, returnAttributeValue, returnError, sendUpdates, serialize, setDirty, setName, setPath, setPersistent, setStore, unregisterfilterNull, from, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, sizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetData, getVersion, isPersistentgetBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttributegetAttribute, getAttributeNames, getAttributes, hasAttribute, sizepublic ClientSharedObject(String name, boolean persistent)
name - Shared Object namepersistent - Persistence flagpublic void connect(IConnection conn)
connect in interface IClientSharedObjectconn - Attach SO to given connectionpublic void disconnect()
disconnect in interface IClientSharedObjectpublic boolean isConnected()
isConnected in interface IClientSharedObjectpublic void addSharedObjectListener(ISharedObjectListener listener)
addSharedObjectListener in interface ISharedObjectBaselistener - the object to notifypublic void removeSharedObjectListener(ISharedObjectListener listener)
removeSharedObjectListener in interface ISharedObjectBaselistener - the object to unregisterpublic void dispatchEvent(IEvent e)
dispatchEvent in interface IEventDispatchere - Event objectprotected void notifyConnect()
protected void notifyDisconnect()
protected void notifyUpdate(String key, Object value)
key - Updated attribute keyvalue - Updated attribute valueprotected void notifyUpdate(String key, Map<String,Object> value)
key - Updated attribute keyvalue - Updated attribute valueprotected void notifyDelete(String key)
key - Attribute nameprotected void notifyClear()
protected void notifySendMessage(String method, List<?> params)
method - Method nameparams - Paramspublic boolean setAttribute(String name, Object value)
setAttribute in interface IAttributeStoresetAttribute in class SharedObjectname - the name of the attribute to changevalue - the new value of the attributepublic boolean setAttributes(IAttributeStore values)
setAttributes in interface IAttributeStoresetAttributes in class SharedObjectvalues - the attributes to setpublic boolean setAttributes(Map<String,Object> values)
setAttributes in interface IAttributeStoresetAttributes in class SharedObjectvalues - the attributes to setpublic boolean removeAttribute(String name)
removeAttribute in interface IAttributeStoreremoveAttribute in interface AttributeStoreMXBeanremoveAttribute in class SharedObjectname - Attributetrueif there's such an attribute and it was removed,
falseotherwise
public void sendMessage(String handler, List<?> arguments)
sendMessage in interface ISharedObjectBasesendMessage in class SharedObjecthandler - Event handlerarguments - Argumentspublic void removeAttributes()
removeAttributes in interface IAttributeStoreremoveAttributes in interface AttributeStoreMXBeanremoveAttributes in class SharedObjectpublic boolean clear()
clear in interface ISharedObjectBaseclear in class SharedObjecttrueon success,
falseotherwise
public void close()
close in interface ISharedObjectBaseclose in class SharedObjectpublic void beginUpdate()
beginUpdate in interface ISharedObjectBasebeginUpdate in class SharedObjectpublic void beginUpdate(IEventListener listener)
beginUpdate in interface ISharedObjectBasebeginUpdate in class SharedObjectlistener - Update with listenerpublic void endUpdate()
endUpdate in interface ISharedObjectBaseendUpdate in class SharedObjectpublic void lock()
lock in interface ISharedObjectBasepublic void unlock()
unlock in interface ISharedObjectBasepublic boolean isLocked()
isLocked in interface ISharedObjectBasepublic void registerServiceHandler(Object handler)
registerServiceHandler in interface ISharedObjectHandlerProviderhandler - the handler objectpublic void unregisterServiceHandler(String name)
unregisterServiceHandler in interface IServiceHandlerProviderunregisterServiceHandler in interface ISharedObjectHandlerProvidername - the name of the handlerpublic void registerServiceHandler(String name, Object handler)
one.two" that provides a method "
callMe", you can call a method "
one.two.callMe" from the client.
registerServiceHandler in interface IServiceHandlerProvidername - the name of the handlerhandler - the handler objectpublic Object getServiceHandler(String name)
getServiceHandler in interface IServiceHandlerProvidername - the name of the handler to returnpublic Set<String> getServiceHandlerNames()
getServiceHandlerNames in interface IServiceHandlerProviderpublic Object getAttribute(String name, Object defaultValue)
getAttribute in interface IAttributeStoregetAttribute in class SharedObjectname - Attribute namedefaultValue - Value to set if attribute doesn't existCopyright © 2005–2017 Red5. All rights reserved.