[java-opensaml COMMIT] /trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java

noreply at shibboleth.net noreply at shibboleth.net
Thu Oct 10 18:26:18 EDT 2013


Author: scantor
Date: Thu Oct 10 18:26:17 2013
New Revision: 3465

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3465&view=rev
Log:
Enable duration-based setting of cleanup interval.

Modified:
    trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java

Modified: trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java?rev=3465&r1=3464&r2=3465&view=diff
==============================================================================
--- trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java (original)
+++ trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java Thu Oct 10 18:26:17 2013
@@ -26,6 +26,8 @@
 
 import org.opensaml.storage.annotation.AnnotationSupport;
 
+import net.shibboleth.utilities.java.support.annotation.Duration;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonNegative;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
 import net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent;
@@ -46,7 +48,7 @@
     /**
      * Number of seconds between cleanup checks. Default value: (0)
      */
-    private long cleanupInterval;
+    @Duration @NonNegative private long cleanupInterval;
 
     /** Timer used to schedule cleanup tasks. */
     private Timer cleanupTaskTimer;
@@ -72,27 +74,28 @@
     }
 
     /**
-     * Gets the number of seconds between one cleanup and another. A value of 0 or less indicates that no
+     * Gets the number of seconds between one cleanup and another. A value of 0 indicates that no
      * cleanup will be performed.
      * 
      * @return number of seconds between one cleanup and another
      */
-    public long getCleanupInterval() {
+    @NonNegative public long getCleanupInterval() {
         return cleanupInterval;
     }
 
     /**
-     * Sets the number of seconds between one cleanup and another. A value of 0 or less indicates that no
+     * Sets the number of seconds between one cleanup and another. A value of 0 indicates that no
      * cleanup will be performed.
      * 
      * This setting cannot be changed after the service has been initialized.
      * 
      * @param interval number of seconds between one cleanup and another
      */
-    public synchronized void setCleanupInterval(final long interval) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-
-        cleanupInterval = interval;
+    public synchronized void setCleanupInterval(@Duration @NonNegative final long interval) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+        cleanupInterval = Constraint.isGreaterThanOrEqual(0, interval,
+                "Cleanup interval must be greater than or equal to zero");
     }
 
     /**



More information about the commits mailing list