[java-openws COMMIT] in /branches/REL_1/src: main/java/org/opensaml/util/resource/ResourceChangeWatcher.java test/jav...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Sep 14 18:00:03 EDT 2012
Author: putmanb
Date: Fri Sep 14 18:00:03 2012
New Revision: 435
URL: http://svn.shibboleth.net/view/java-openws?rev=435&view=rev
Log:
More work on JOWS-37, this time on ResourceChangeWatcher constructor.
Added:
branches/REL_1/src/test/java/org/opensaml/util/resource/ResourceChangeWatcherTest.java (with props)
Modified:
branches/REL_1/src/main/java/org/opensaml/util/resource/ResourceChangeWatcher.java
Modified: branches/REL_1/src/main/java/org/opensaml/util/resource/ResourceChangeWatcher.java
URL: http://svn.shibboleth.net/view/java-openws/branches/REL_1/src/main/java/org/opensaml/util/resource/ResourceChangeWatcher.java?rev=435&r1=434&r2=435&view=diff
==============================================================================
--- branches/REL_1/src/main/java/org/opensaml/util/resource/ResourceChangeWatcher.java (original)
+++ branches/REL_1/src/main/java/org/opensaml/util/resource/ResourceChangeWatcher.java Fri Sep 14 18:00:03 2012
@@ -111,16 +111,27 @@
maxRetryAttempts = retryAttempts;
currentRetryAttempts = 0;
- if (watchedResource.exists()) {
- resourceExist = true;
- lastModification = watchedResource.getLastModifiedTime();
- } else {
- resourceExist = false;
- }
-
resourceListeners = new ArrayList<ResourceChangeListener>(5);
log.debug("Watching resource: " + watchedResource.getLocation()
+ ", polling frequency: {}ms, max retry attempts: {}", pollFrequency, maxRetryAttempts);
+
+ try {
+ if (watchedResource.exists()) {
+ resourceExist = true;
+ lastModification = watchedResource.getLastModifiedTime();
+ } else {
+ resourceExist = false;
+ }
+ } catch (ResourceException e) {
+ log.warn("Resource " + watchedResource.getLocation() + " could not be accessed", e);
+ currentRetryAttempts++;
+ if (currentRetryAttempts >= maxRetryAttempts) {
+ log.error("Resource {} was not accessible at time of ResourceChangeWatcher construction and max retrys are exceeded",
+ watchedResource.getLocation());
+ throw e;
+ }
+ }
+
}
/**
@@ -169,8 +180,8 @@
currentRetryAttempts++;
if (currentRetryAttempts >= maxRetryAttempts) {
cancel();
- log.error("Resource " + watchedResource.getLocation()
- + " was not accessible for max number of retry attempts. This resource will no longer be watched");
+ log.error("Resource {} was not accessible for max number of retry attempts. This resource will no longer be watched",
+ watchedResource.getLocation());
}
}
}
More information about the commits
mailing list