org.opensaml.util.resource
Modifier and Type | Field and Description |
---|---|
private int |
currentRetryAttempts
Number of times the resource has been polled but generated an error.
|
static int |
DEFAULT_MAX_RETRY_ATTEMPTS
Default maximum retry attempts, 0.
|
static long |
DEFAULT_POLL_FREQUENCY
Default polling frequency, 12 hours.
|
private DateTime |
lastModification
Last time the resource was modified.
|
private Logger |
log
Class logger.
|
private int |
maxRetryAttempts
Max number of polls to try before considering the resource inaccessible.
|
private long |
pollFrequency
Frequency, in milliseconds, the resource is polled for changes.
|
private boolean |
resourceExist
Whether the resource currently exists.
|
private List<ResourceChangeListener> |
resourceListeners
Registered listeners of resource change notifications.
|
private Resource |
watchedResource
Resource being watched.
|
Constructor and Description |
---|
ResourceChangeWatcher(Resource resource)
Constructor.
|
ResourceChangeWatcher(Resource resource,
long pollingFrequency)
Constructor.
|
ResourceChangeWatcher(Resource resource,
long pollingFrequency,
int retryAttempts)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
getPollingFrequency()
Gets the frequency, in milliseconds, the watched resource should be polled.
|
List<ResourceChangeListener> |
getResourceListeners()
Gets the list of registered resource listeners.
|
void |
run() |
protected void |
signalListeners(ResourceChangeListener.ResourceChange changeType)
Signals all registered listeners of a resource change.
|
cancel, scheduledExecutionTime
public static final long DEFAULT_POLL_FREQUENCY
public static final int DEFAULT_MAX_RETRY_ATTEMPTS
private final Logger log
private Resource watchedResource
private long pollFrequency
private int maxRetryAttempts
private int currentRetryAttempts
private boolean resourceExist
private DateTime lastModification
private List<ResourceChangeListener> resourceListeners
public ResourceChangeWatcher(Resource resource) throws ResourceException
resource
- the resource to be watchedResourceException
- thrown if resource existence or last modification time can not be determinedpublic ResourceChangeWatcher(Resource resource, long pollingFrequency) throws ResourceException
resource
- the resource to be watchedpollingFrequency
- the frequency, in milliseconds, to poll the resource for changesResourceException
- thrown if resource existence or last modification time can not be determinedpublic ResourceChangeWatcher(Resource resource, long pollingFrequency, int retryAttempts) throws ResourceException
resource
- the resource to be watchedpollingFrequency
- the frequency, in milliseconds, to poll the resource for changesretryAttempts
- maximum number of poll attempts before the resource is considered inaccessibleResourceException
- thrown if resource existence or last modification time can not be determinedpublic long getPollingFrequency()
public List<ResourceChangeListener> getResourceListeners()
protected void signalListeners(ResourceChangeListener.ResourceChange changeType)
changeType
- the resource change typeCopyright © 1999-2013 JBoss by Red Hat. All Rights Reserved.