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 class
Connection handler is a class whose instance listens for connection events of the wrapped channel. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Channel
The channel to wrapprotected ChannelTimeRecord
The latest channel record found by the monitorprotected ChannelWrapper.ConnectionHandler
The handler handles channel connection eventsprotected Monitor
The monitor for the channel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConnectionListener
(ConnectionListener listener) Add the specified object as a listener of channel connection events of the channel that is wrapped.void
dispose()
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 void
Create a monitor to listen for new channel records.void
removeConnectionListener
(ConnectionListener listener) Remove the specified object from being a listener of channel connection events of the channel that is wrapped.protected void
Request 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.
-