public class ArchivingService extends Object implements DisposableBean, InitializingBean, SmartInitializingSingleton
refreshChannel(String)
method.Constructor and Description |
---|
ArchivingService() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
afterSingletonsInstantiated() |
void |
destroy() |
ChannelStatus |
getChannelStatus(String channelName)
Returns the status of an archived channel.
|
List<ChannelStatus> |
getChannelStatusForAllChannels()
Returns a list of the status for all channels known by this archiving
service.
|
long |
getNumberOfSamplesDropped()
Returns the total number of samples that have been dropped.
|
long |
getNumberOfSamplesWritten()
Returns the total number of samples that have been written.
|
void |
onServerOnlineStatusEvent(ServerOnlineStatusEvent event)
Notifies the archiving service that the server's online status changed.
|
ListenableFuture<Void> |
refreshChannel(String channelName)
Reloads the configuration of the specified channel.
|
void |
setArchiveAccessService(ArchiveAccessService archiveAccessService)
Sets the archive access service that is used to read samples from the
database.
|
void |
setCassandraProvider(CassandraProvider cassandraProvider)
Sets the Cassandra provider that provides access to the Apache Cassandra
database.
|
void |
setChannelMetaDataDAO(ChannelMetaDataDAO channelMetaDataDAO)
Sets the DAO for reading and modifying meta-data related to channels.
|
void |
setClusterManagementService(ClusterManagementService clusterManagementService)
Sets the cluster management service.
|
void |
setControlSystemSupportRegistry(ControlSystemSupportRegistry controlSystemSupportRegistry)
Sets the control-system support registry.
|
void |
setServerProperties(ServerProperties serverProperties)
Sets the server-specific configuration properties.
|
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void afterSingletonsInstantiated()
afterSingletonsInstantiated
in interface SmartInitializingSingleton
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
public ChannelStatus getChannelStatus(String channelName)
null
is returned. Throws an
IllegalStateException
if the archiving service has not finished
initialization of its channel list yet.channelName
- name of the channel to be queried.null
if the
specified channel is not known by this archiving service.IllegalStateException
- if the archiving service has not initialized its list of
channels yet.public List<ChannelStatus> getChannelStatusForAllChannels()
IllegalStateException
if the archiving service
has not finished initialization of its channel list yet. The channels are
returned in the natural order of their names. The returned list is never
null
, but it might be empty if no channels belong this
server.IllegalStateException
- if the archiving service has not initialized its list f
channels yet.public long getNumberOfSamplesDropped()
public long getNumberOfSamplesWritten()
@EventListener public void onServerOnlineStatusEvent(ServerOnlineStatusEvent event)
Notifies the archiving service that the server's online status changed.
Typically, this method is automatically called by the Spring container
when the ClusterManagementService
publishes
ServerOnlineStatusEvent
.
This method takes care of starting archiving when the server goes online and stopping it when the server goes offline. These operations are performed asynchronously so that the thread sending the notification does not block.
event
- event specifying the server's new online status.public ListenableFuture<Void> refreshChannel(String channelName)
Reloads the configuration of the specified channel. This method should be called whenever the configuration of a channel belonging to this server has been changed. It also needs to be called after registering a pending operation for a channel, so that archiving for the channel can be disabled.
If the server is currently offline, calling this method will typically have no effect because there is no need to reload the channel configuration. In this case, the future returned by this method completed immediately.
The future returned by this method completes when the refresh operation has finished. It should never throw an exception.
channelName
- name of the channel to be refreshed.NullPointerException
- if channelName
is null
.@Autowired public void setArchiveAccessService(ArchiveAccessService archiveAccessService)
archiveAccessService
- archive access service used for reading samples when
generating decimated samples.@Autowired public void setCassandraProvider(CassandraProvider cassandraProvider)
cassandraProvider
- provider that provides a connection to the Apache Cassandra
database.@Autowired public void setChannelMetaDataDAO(ChannelMetaDataDAO channelMetaDataDAO)
channelMetaDataDAO
- channel meta-data DAO to be used by this object.@Autowired public void setClusterManagementService(ClusterManagementService clusterManagementService)
clusterManagementService
- cluster manager used by the archiving server.@Autowired public void setControlSystemSupportRegistry(ControlSystemSupportRegistry controlSystemSupportRegistry)
controlSystemSupportRegistry
- control-system support registry for this archiving server.@Autowired public void setServerProperties(ServerProperties serverProperties)
serverProperties
- configuration properties used by this server.Copyright © 2011–2017 aquenos GmbH. All rights reserved.