public abstract class ChannelHandler extends Object
Constructor and Description |
---|
ChannelHandler(String channelName)
Creates a new channel handler.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addReader(ChannelHandlerReadSubscription subscription)
Used by the data source to add a read request on the channel managed
by this handler.
|
protected abstract void |
addWriter(ChannelHandlerWriteSubscription subscription)
Used by the data source to prepare the channel managed by this handler
for write.
|
String |
getChannelName()
Returns the name of the channel.
|
Map<String,Object> |
getProperties()
Returns extra information about the channel, typically
useful for debugging.
|
abstract int |
getReadUsageCounter()
Returns how many readers are open on this channel.
|
abstract int |
getUsageCounter()
Returns how many readers or writers are open on
this channel.
|
abstract int |
getWriteUsageCounter()
Returns how many writers are open on this channel.
|
abstract boolean |
isConnected()
Returns true if it is connected.
|
protected abstract void |
removeReader(ChannelHandlerReadSubscription subscription)
Used by the data source to remove a read request.
|
protected abstract void |
removeWrite(ChannelHandlerWriteSubscription subscription)
Used by the data source to conclude writes to the channel managed by this handler.
|
protected abstract void |
write(Object newValue,
ChannelWriteCallback callback)
Implements a write operation.
|
public ChannelHandler(String channelName)
channelName
- the name of the channel this handler will be responsible ofpublic Map<String,Object> getProperties()
public String getChannelName()
public abstract int getUsageCounter()
public abstract int getReadUsageCounter()
public abstract int getWriteUsageCounter()
protected abstract void addReader(ChannelHandlerReadSubscription subscription)
subscription
- the data required for a subscriptionprotected abstract void removeReader(ChannelHandlerReadSubscription subscription)
subscription
- the subscription to removeprotected abstract void addWriter(ChannelHandlerWriteSubscription subscription)
subscription
- the data required for the subscriptionprotected abstract void removeWrite(ChannelHandlerWriteSubscription subscription)
subscription
- the subscription to removeprotected abstract void write(Object newValue, ChannelWriteCallback callback)
newValue
- new value to be writtencallback
- called when done or on errorpublic abstract boolean isConnected()
Copyright © 2010–2015. All rights reserved.