Class WicaStreamPolledValueRequesterService

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

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

    • WicaStreamPolledValueRequesterService

      WicaStreamPolledValueRequesterService(@Value("${wica.channel-resource-release-interval-in-secs}") int wicaChannelResourceReleaseIntervalInSecs, @Value("${wica.channel-publish-poller-restarts}") boolean wicaChannelPublishPollerRestarts, @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.
      wicaChannelPublishPollerRestarts - determines whether a channel disconnect value will be published if the polling 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 polled value is acquired.
      applicationEventPublisher - reference to the application publisher which will be used to publish the channels that are to be polled or which are no longer of interest.
  • Method Details

    • discardPollersThatHaveReachedEndOfLife

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

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

      void startPolling(WicaStream wicaStream)
      Starts polling operations on the specified stream.
      Parameters:
      wicaStream - the stream to poll.
    • stopPolling

      void stopPolling(WicaStream wicaStream)
      Stops polling operations on 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.