|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.epics.pvmanager.ChannelHandler
org.epics.pvmanager.MultiplexedChannelHandler<ConnectionPayload,MessagePayload>
ConnectionPayload - type of the payload for the connectionMessagePayload - type of the payload for each messagepublic abstract class MultiplexedChannelHandler<ConnectionPayload,MessagePayload>
Implements a ChannelHandler on top of a single subscription and
multiplexes all reads on top of it.
| Constructor Summary | |
|---|---|
MultiplexedChannelHandler(java.lang.String channelName)
Creates a new channel handler. |
|
| Method Summary | |
|---|---|
protected void |
addMonitor(ChannelHandlerReadSubscription subscription)
Used by the data source to add a read request on the channel managed by this handler. |
protected void |
addWriter(WriteCache<?> cache,
ExceptionHandler handler)
Used by the data source to prepare the channel managed by this handler for write. |
protected abstract void |
connect()
Used by the handler to open the connection. |
protected abstract void |
disconnect()
Used by the handler to close the connection. |
protected DataSourceTypeAdapter<ConnectionPayload,MessagePayload> |
findTypeAdapter(ValueCache<?> cache,
ConnectionPayload connection)
Finds the right adapter to use for the particular cache given the information of the channels in the connection payload. |
protected ConnectionPayload |
getConnectionPayload()
The last processes connection payload. |
protected MessagePayload |
getLastMessagePayload()
The last processed message payload. |
int |
getReadUsageCounter()
Returns how many read PVs are open on this channel. |
int |
getUsageCounter()
Returns how many read or write PVs are open on this channel. |
int |
getWriteUsageCounter()
Returns how many write PVs are open on this channel. |
boolean |
isConnected()
Returns true if it is connected. |
protected boolean |
isConnected(ConnectionPayload payload)
Determines from the payload whether the channel is connected or not. |
protected void |
processConnection(ConnectionPayload connectionPayload)
Process the next connection payload. |
protected void |
processMessage(MessagePayload payload)
Process the payload for this channel. |
protected void |
removeMonitor(Collector<?> collector)
Used by the data source to remove a read request. |
protected void |
removeWrite(WriteCache<?> cache,
ExceptionHandler exceptionHandler)
Used by the data source to conclude writes to the channel managed by this handler. |
protected void |
reportExceptionToAllReadersAndWriters(java.lang.Exception ex)
Notifies all readers and writers of an error condition. |
protected abstract void |
write(java.lang.Object newValue,
ChannelWriteCallback callback)
Implements a write operation. |
| Methods inherited from class org.epics.pvmanager.ChannelHandler |
|---|
getChannelName, getProperties |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiplexedChannelHandler(java.lang.String channelName)
channelName - the name of the channel this handler will be responsible of| Method Detail |
|---|
protected final void reportExceptionToAllReadersAndWriters(java.lang.Exception ex)
ex - the exception to notifyprotected final ConnectionPayload getConnectionPayload()
protected final MessagePayload getLastMessagePayload()
protected final void processConnection(ConnectionPayload connectionPayload)
connectionPayload -
protected DataSourceTypeAdapter<ConnectionPayload,MessagePayload> findTypeAdapter(ValueCache<?> cache,
ConnectionPayload connection)
DataSourceTypeSupport as
a good first implementation.
cache - the cache that will store the dataconnection - the connection payload
public int getUsageCounter()
getUsageCounter in class ChannelHandlerpublic int getReadUsageCounter()
getReadUsageCounter in class ChannelHandlerpublic int getWriteUsageCounter()
getWriteUsageCounter in class ChannelHandlerprotected void addMonitor(ChannelHandlerReadSubscription subscription)
addMonitor in class ChannelHandlersubscription - the data required for a subscriptionprotected void removeMonitor(Collector<?> collector)
removeMonitor in class ChannelHandlercollector - the collector that does not need to be notified anymore
protected void addWriter(WriteCache<?> cache,
ExceptionHandler handler)
addWriter in class ChannelHandlerhandler - to be notified in case of errors
protected void removeWrite(WriteCache<?> cache,
ExceptionHandler exceptionHandler)
removeWrite in class ChannelHandlerexceptionHandler - to be notified in case of errorsprotected final void processMessage(MessagePayload payload)
DataSourceTypeAdapter
for each read monitor that was setup.
payload - the payload of for this type of channelprotected abstract void connect()
protected abstract void disconnect()
protected abstract void write(java.lang.Object newValue,
ChannelWriteCallback callback)
write in class ChannelHandlernewValue - new value to be writtencallback - called when done or on errorprotected boolean isConnected(ConnectionPayload payload)
By default, this uses the usage counter to determine whether it's connected or not. One should override this to use the actual connection payload to check whether the actual protocol connection has been established.
payload - the connection payload
public final boolean isConnected()
isConnected in class ChannelHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||