Package xal.service.pvlogger
Class ChannelWrapper
java.lang.Object
xal.service.pvlogger.ChannelWrapper
ChannelWrapper is a wrapper for a Channel that handles connecting to the
channel and setting up a monitor when its channel is connected. Cache the
latest channel record that has been found by the monitor.
- Author:
- tap
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classConnection handler is a class whose instance listens for connection events of the wrapped channel. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ChannelThe channel to wrapprotected ChannelTimeRecordThe latest channel record found by the monitorprotected ChannelWrapper.ConnectionHandlerThe handler handles channel connection eventsprotected MonitorThe monitor for the channel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectionListener(ConnectionListener listener) Add the specified object as a listener of channel connection events of the channel that is wrapped.voiddispose()Dispose of the channel resources: Shutdown the monitor if a monitor is active.Get the wrapped channel.getPV()Get the PV for the channel being wrapped.Get the latest channel record cached.protected voidCreate a monitor to listen for new channel records.voidremoveConnectionListener(ConnectionListener listener) Remove the specified object from being a listener of channel connection events of the channel that is wrapped.protected voidRequest that the channel be connected.
-
Field Details
-
channel
The channel to wrap -
monitor
The monitor for the channel -
channelRecord
The latest channel record found by the monitor -
connectionHandler
The handler handles channel connection events
-
-
Constructor Details
-
ChannelWrapper
ChannelWrapper constructor- Parameters:
pv- The PV for which to create a channel.
-
-
Method Details
-
dispose
public void dispose()Dispose of the channel resources: Shutdown the monitor if a monitor is active. Remove the connection handler as a connection listener of the channel. -
addConnectionListener
Add the specified object as a listener of channel connection events of the channel that is wrapped.- Parameters:
listener- the object to add as a connection listener.
-
removeConnectionListener
Remove the specified object from being a listener of channel connection events of the channel that is wrapped.- Parameters:
listener- the object to remove from being a connection listener
-
requestConnection
protected void requestConnection()Request that the channel be connected. When the channel connection occurs, create a monitor. If a channel is dropped then clear the record. -
makeMonitor
protected void makeMonitor()Create a monitor to listen for new channel records. An instance of an internal anonymous class is the listener of the monitor events and caches the latest channel record. -
getPV
Get the PV for the channel being wrapped.- Returns:
- the PV
-
getChannel
Get the wrapped channel.- Returns:
- the wrapped channel
-
getRecord
Get the latest channel record cached.- Returns:
- the latest channel record cached.
-