Package org.epics.gpclient.datasource
Class ChannelHandler
- java.lang.Object
-
- org.epics.gpclient.datasource.ChannelHandler
-
- Direct Known Subclasses:
MultiplexedChannelHandler
public abstract class ChannelHandler extends Object
Manages the connection of a channel for a data source.- Author:
- carcassi
-
-
Constructor Summary
Constructors Constructor Description ChannelHandler(String channelName)
Creates a new channel handler.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addReader(ReadCollector collector)
Starts sending read notification to the given collector.protected abstract void
addWriter(WriteCollector collector)
Starts sending/receiving write notification to the given collector.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(ReadCollector collector)
Stops sending read notification to the given collector.protected abstract void
removeWriter(WriteCollector collector)
Stops sending/receiving write notification to the given collector.
-
-
-
Constructor Detail
-
ChannelHandler
public ChannelHandler(String channelName)
Creates a new channel handler.- Parameters:
channelName
- the name of the channel this handler will be responsible of
-
-
Method Detail
-
getProperties
public Map<String,Object> getProperties()
Returns extra information about the channel, typically useful for debugging.- Returns:
- a property map
-
getChannelName
public String getChannelName()
Returns the name of the channel.- Returns:
- the channel name; can't be null
-
getUsageCounter
public abstract int getUsageCounter()
Returns how many readers or writers are open on this channel.- Returns:
- the number of open readers and writers
-
getReadUsageCounter
public abstract int getReadUsageCounter()
Returns how many readers are open on this channel.- Returns:
- the number of open readers
-
getWriteUsageCounter
public abstract int getWriteUsageCounter()
Returns how many writers are open on this channel.- Returns:
- the number of open writers
-
addReader
protected abstract void addReader(ReadCollector collector)
Starts sending read notification to the given collector.- Parameters:
collector
- the data collector
-
removeReader
protected abstract void removeReader(ReadCollector collector)
Stops sending read notification to the given collector.- Parameters:
collector
- the data collector
-
addWriter
protected abstract void addWriter(WriteCollector collector)
Starts sending/receiving write notification to the given collector.- Parameters:
collector
- the data collector
-
removeWriter
protected abstract void removeWriter(WriteCollector collector)
Stops sending/receiving write notification to the given collector.- Parameters:
collector
- the data collector
-
isConnected
public abstract boolean isConnected()
Returns true if it is connected.- Returns:
- true if underlying channel is connected
-
-