@ManagedResource(description="handles archiving operations") public class ArchivingService extends Object implements DisposableBean, InitializingBean, SelfNaming, 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.
|
ObjectName |
getObjectName() |
int |
getSamplesDecimationCurrentRunningFetchOperations()
Returns the number of sample fetch operations that are running currently.
|
int |
getSamplesDecimationCurrentSamplesInMemory()
Returns the number of samples that have been fetched (but not processed
yet).
|
int |
getSamplesDecimationMaxRunningFetchOperations()
Returns the max. number of sample fetch operations that may run
concurrently.
|
int |
getSamplesDecimationMaxSamplesInMemory()
Returns the max. number of samples that may concurrently be kept in
memory.
|
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.
|
void |
setThrottlingProperties(ThrottlingProperties throttlingProperties)
Sets the configuration properties controlling throttling.
|
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 ObjectName getObjectName() throws MalformedObjectNameException
getObjectName
in interface SelfNaming
MalformedObjectNameException
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.@ManagedAttribute(description="number of samples that been dropped since the archiving service was started") public long getNumberOfSamplesDropped()
@ManagedAttribute(description="number of samples that been writen since the archiving service was started") public long getNumberOfSamplesWritten()
@ManagedAttribute(description="number of sample fetch operations (to generate decimated samples) that are currently running") public int getSamplesDecimationCurrentRunningFetchOperations()
Returns the number of sample fetch operations that are running currently.
Usually, decimated samples are generated as new (raw) samples are
written. However, when adding a new decimation level or when restarting
the server, it might be necessary to read samples from the database in
order to generate decimated samples. In this case, the number of fetch
operations that may run concurrently is limited (to the number returned
by getSamplesDecimationMaxRunningFetchOperations()
).
getSamplesDecimationCurrentSamplesInMemory()
,
getSamplesDecimationMaxRunningFetchOperations()
@ManagedAttribute(description="current number of samples that have been fetched (to generate decimated samples), but not processed yet") public int getSamplesDecimationCurrentSamplesInMemory()
Returns the number of samples that have been fetched (but not processed yet). This is the number of samples that is currently kept in memory.
Usually, decimated samples are generated as new (raw) samples are
written. However, when adding a new decimation level or when restarting
the server, it might be necessary to read samples from the database in
order to generate decimated samples. For performance reasons, samples are
fetched in batches. These samples, that have been fetched, but not
processed yet, consume memory, so that no new fetch operations may be
started if a large number of samples has already been fetched, but not
processed yet. The actual limit is returned by
getSamplesDecimationMaxSamplesInMemory()
.
getSamplesDecimationCurrentRunningFetchOperations()
,
getSamplesDecimationMaxSamplesInMemory()
@ManagedAttribute(description="max. number of sample fetch operations (to generate decimated samples) that may run concurrently") public int getSamplesDecimationMaxRunningFetchOperations()
Returns the max. number of sample fetch operations that may run concurrently.
Usually, decimated samples are generated as new (raw) samples are written. However, when adding a new decimation level or when restarting the server, it might be necessary to read samples from the database in order to generate decimated samples. In this case, the number of fetch operations that may run concurrently is limited to the number returned by this method.
getSamplesDecimationCurrentRunningFetchOperations()
,
getSamplesDecimationMaxSamplesInMemory()
@ManagedAttribute(description="max. number of samples that may be fetched into memory") public int getSamplesDecimationMaxSamplesInMemory()
Returns the max. number of samples that may concurrently be kept in memory.
Usually, decimated samples are generated as new (raw) samples are written. However, when adding a new decimation level or when restarting the server, it might be necessary to read samples from the database in order to generate decimated samples. For performance reasons, samples are fetched in batches. These samples, that have been fetched, but not processed yet, consume memory, so that no new fetch operations may be started if a large number of samples has already been fetched, but not processed yet. This method returns the number of samples at which this limit is enforced and no more samples are fetched.
getSamplesDecimationCurrentSamplesInMemory()
,
getSamplesDecimationMaxRunningFetchOperations()
@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 setThrottlingProperties(ThrottlingProperties throttlingProperties)
throttlingProperties
- configuration properties controlling throttling.@Autowired public void setServerProperties(ServerProperties serverProperties)
serverProperties
- configuration properties used by this server.Copyright © 2011–2017 aquenos GmbH. All rights reserved.