public abstract class BaseReloadableService extends BaseService implements ReloadableService
BaseService
that allows the service's context to be reloaded if the underlying configuration
resources are changed.
If, at construction time, polling frequency and retry attempt are given then the configuration resources will be
watched for changes. If a change is detected then the current service's context will be dropped and a new one created
from all resource files. If there is a problem loading a configuration resource during this process the existing
service context is kept and an error is logged. The result of this occuring during the initial configuration load is
implementation dependent.
NOTE: Service implementations must take out a read lock, through BaseService.getReadWriteLock()
,
whenever reading or operating on information controlled by the service context. This will ensure that if a
configuration change occurs the service context will not be replaced until after all current reads have completed.修飾子とタイプ | クラスと説明 |
---|---|
protected class |
BaseReloadableService.ConfigurationResourceListener
A listener for policy resource changes that triggers a reloading of the AFP context.
|
コンストラクタと説明 |
---|
BaseReloadableService()
Constructor.
|
修飾子とタイプ | メソッドと説明 |
---|---|
void |
destroy()
Destroys a service, freeing any resources it may currently be using.
|
long |
getPollingFrequency()
Gets the frequency, in milliseconds, that the configuration resources are polled.
|
int |
getPollingRetryAttempts()
Gets the number of times a resource may error out before it is considered permanently invalid.
|
Timer |
getPollingTimer()
Gets the timer used to resource polling jobs.
|
void |
initialize()
Initializes this service.
|
void |
reload()
Reloads the configuration of the service.
|
void |
setPollingFrequency(long frequency)
Sets the frequency, in milliseconds, that the configuration resources are polled.
|
void |
setPollingRetryAttempts(int attempts)
Sets the number of times a resource may error out before it is considered permanently invalid.
|
void |
setPollingTimer(Timer timer)
Sets the timer used to resource polling jobs.
|
getApplicationContext, getId, getReadWriteLock, getServiceConfigurations, getServiceContext, isDestroyed, isInitialized, loadContext, onNewContextCreated, setApplicationContext, setBeanName, setInitialized, setServiceConfigurations, setServiceContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getId, isDestroyed, isInitialized
public BaseReloadableService()
public Timer getPollingTimer()
public void setPollingTimer(Timer timer)
timer
- timer used to resource polling jobspublic long getPollingFrequency()
public void setPollingFrequency(long frequency)
frequency
- the frequency, in milliseconds, that the configuration resources are polledpublic int getPollingRetryAttempts()
public void setPollingRetryAttempts(int attempts)
attempts
- number of times a resource may error out before it is considered permanently invalidpublic void initialize() throws ServiceException
initialize
インタフェース内 Service
initialize
クラス内 BaseService
ServiceException
- thrown if there is a problem initializing the servicepublic void reload() throws ServiceException
reload
インタフェース内 ReloadableService
ServiceException
- thrown if there is a problem reloading the servicepublic void destroy() throws ServiceException
destroy
インタフェース内 Service
destroy
クラス内 BaseService
ServiceException
- thrown if there is a problem destroying the serviceCopyright © 2012. All Rights Reserved.