Class ChannelWrapper

java.lang.Object
xal.service.pvlogger.ChannelWrapper

public class ChannelWrapper extends Object
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
  • Field Details

    • channel

      protected Channel channel
      The channel to wrap
    • monitor

      protected Monitor monitor
      The monitor for the channel
    • channelRecord

      protected volatile ChannelTimeRecord channelRecord
      The latest channel record found by the monitor
    • connectionHandler

      protected ChannelWrapper.ConnectionHandler connectionHandler
      The handler handles channel connection events
  • Constructor Details

    • ChannelWrapper

      public ChannelWrapper(String pv)
      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

      public void addConnectionListener(ConnectionListener listener)
      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

      public void removeConnectionListener(ConnectionListener listener)
      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

      public String getPV()
      Get the PV for the channel being wrapped.
      Returns:
      the PV
    • getChannel

      public Channel getChannel()
      Get the wrapped channel.
      Returns:
      the wrapped channel
    • getRecord

      public ChannelTimeRecord getRecord()
      Get the latest channel record cached.
      Returns:
      the latest channel record cached.