Package ch.psi.wica.services.stream
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 Summary
ConstructorsConstructorDescriptionWicaStreamPolledValueRequesterService
(int wicaChannelResourceReleaseIntervalInSecs, boolean wicaChannelPublishPollerRestarts, boolean wicaChannelPublishChannelValueInitialState, org.springframework.context.ApplicationEventPublisher applicationEventPublisher) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method runs periodically to scan the discard list for entries corresponding to polled channels that are no longer of interest(package private) int
getInterestCountForChannel
(WicaChannel wicaChannel) Returns the level of interest in a WicaChannel.(package private) void
restartPolling
(WicaStream wicaStream) Restarts the control system polling of the channels in the specified stream.(package private) void
startPolling
(WicaStream wicaStream) Starts polling operations on the specified stream.(package private) void
stopPolling
(WicaStream wicaStream) Stops polling operations on the specified stream.
-
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
Restarts the control system polling of the channels in the specified stream.- Parameters:
wicaStream
- the stream on which polling is to be restarted.
-
startPolling
Starts polling operations on the specified stream.- Parameters:
wicaStream
- the stream to poll.
-
stopPolling
Stops polling operations on the specified stream.- Parameters:
wicaStream
- the stream that is no longer of interest.
-
getInterestCountForChannel
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.
-