Class WicaStreamMonitoredValueRequesterService

java.lang.Object
ch.psi.wica.services.stream.WicaStreamMonitoredValueRequesterService

@Configuration @EnableScheduling @Service @ThreadSafe public class WicaStreamMonitoredValueRequesterService extends Object
Provides a service for starting and stopping the control system monitoring of the channels in a WicaStream.
  • Constructor Details

    • WicaStreamMonitoredValueRequesterService

      WicaStreamMonitoredValueRequesterService(@Value("${wica.channel-resource-release-interval-in-secs}") int wicaChannelResourceReleaseIntervalInSecs, @Value("${wica.channel-publish-monitor-restarts}") boolean wicaChannelPublishMonitorRestarts, @Value("${wica.channel-publish-channel-value-initial-state}") boolean wicaChannelPublishChannelValueInitialState, @Autowired org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
      Constructs a new instance.
      Parameters:
      wicaChannelResourceReleaseIntervalInSecs - period after which the resources associated with a Wica Channel will be released if they are no longer in use.
      wicaChannelPublishMonitorRestarts - determines whether a channel disconnect value will be published if the monitoring associated with the channel is restarted.
      wicaChannelPublishChannelValueInitialState - determines whether a channel's initial value will be published as DISCONNECTED when a channel is first created or whether nothing will be published until the first monitored value is acquired.
      applicationEventPublisher - reference to the application publisher which will be used to publish the channels that are to be monitored or which are no longer of interest.
  • Method Details

    • discardMonitorsThatHaveReachedEndOfLife

      @Scheduled(fixedRate=1000L) public void discardMonitorsThatHaveReachedEndOfLife()
      This method runs periodically to scan the discard list for entries corresponding to monitored channels that are no longer of interest
    • restartMonitoring

      void restartMonitoring(WicaStream wicaStream)
      Restarts the control system monitoring of the channels in the specified stream.
      Parameters:
      wicaStream - the stream on which monitoring is to be restarted.
    • startMonitoring

      void startMonitoring(WicaStream wicaStream)
      Starts monitoring the channels in the specified stream.
      Parameters:
      wicaStream - the stream to monitor.
    • stopMonitoring

      void stopMonitoring(WicaStream wicaStream)
      Stops monitoring the channels in the specified stream.
      Parameters:
      wicaStream - the stream that is no longer of interest.
    • getInterestCountForChannel

      int getInterestCountForChannel(WicaChannel wicaChannel)
      Returns the level of interest in a WicaChannel.
      Parameters:
      wicaChannel - the name of the channel to lookup.
      Returns:
      the current interest count (or zero if the channel was not recognised).
      Implementation Note:
      this method is provided mainly for test purposes.
    • getLastEventForChannel

      Optional<LocalDateTime> getLastEventForChannel(WicaChannel wicaChannel)
      Returns the timestamp of the last event
      Parameters:
      wicaChannel - the name of the channel to lookup.
      Returns:
      the current interest count (or zero if the channel was not recognised).
      Implementation Note:
      this method is provided mainly for test purposes.