[java-identity-provider COMMIT] in /trunk/idp-core/src/main/java/net/shibboleth/idp/service: AbstractReloadableServic...

noreply at shibboleth.net noreply at shibboleth.net
Wed Feb 6 15:56:24 EST 2013


Author: scantor
Date: Wed Feb  6 15:56:24 2013
New Revision: 4278

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4278&view=rev
Log:
Annotate methods.

Modified:
    trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractReloadableService.java
    trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractService.java
    trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractSpringReloadableService.java
    trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractSpringService.java
    trunk/idp-core/src/main/java/net/shibboleth/idp/service/ReloadableService.java
    trunk/idp-core/src/main/java/net/shibboleth/idp/service/Service.java
    trunk/idp-core/src/main/java/net/shibboleth/idp/service/ServiceException.java

Modified: trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractReloadableService.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractReloadableService.java?rev=4278&r1=4277&r2=4278&view=diff
==============================================================================
--- trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractReloadableService.java (original)
+++ trunk/idp-core/src/main/java/net/shibboleth/idp/service/AbstractReloadableService.java Wed Feb  6 15:56:24 2013
@@ -22,6 +22,9 @@
 import java.util.TimerTask;
 import java.util.concurrent.locks.Lock;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import net.shibboleth.idp.log.EventLogger;
 import net.shibboleth.idp.log.PerformanceEvent;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
@@ -93,7 +96,7 @@
      * 
      * @return timer used to schedule configuration reload tasks
      */
-    public Timer getReloadTaskTimer() {
+    @Nullable public Timer getReloadTaskTimer() {
         return reloadTaskTimer;
     }
 
@@ -104,7 +107,7 @@
      * 
      * @param timer timer used to schedule configuration reload tasks
      */
-    public synchronized void setReloadTaskTimer(Timer timer) {
+    public synchronized void setReloadTaskTimer(@Nullable final Timer timer) {
         if (isInitialized()) {
             return;
         }
@@ -113,17 +116,17 @@
     }
 
     /** {@inheritDoc} */
-    public DateTime getLastReloadAttemptInstant() {
+    @Nullable public DateTime getLastReloadAttemptInstant() {
         return lastReloadInstant;
     }
 
     /** {@inheritDoc} */
-    public DateTime getLastSuccessfulReloadInstant() {
+    @Nullable public DateTime getLastSuccessfulReloadInstant() {
         return lastSuccessfulReleaseIntant;
     }
 
     /** {@inheritDoc} */
-    public Throwable getReloadFailureCause() {
+    @Nullable public Throwable getReloadFailureCause() {
         return reloadFailureCause;
     }
 
@@ -132,7 +135,7 @@
         super.doInitialize();
         
         if (reloadCheckDelay > 0) {
-            Constraint.isNotNull(reloadTaskTimer, "Reload task timer may not be null");
+            Constraint.isNotNull(reloadTaskTimer, "Reload task timer cannot be null");
             reloadTask = new ServiceReloadTask();
             reloadTaskTimer.schedule(reloadTask, reloadCheckDelay, reloadCheckDelay);
         }
@@ -147,12 +150,12 @@
      * performance event.
      */
     public final void reload() {
-        PerformanceEvent perfEvent = new PerformanceEvent(getId() + ".reload");
-
-        Lock serviceWriteLock = getServiceLock().writeLock();
-        HashMap context = new HashMap();
-
-        DateTime now = new DateTime(ISOChronology.getInstanceUTC());
+        final PerformanceEvent perfEvent = new PerformanceEvent(getId() + ".reload");
+
+        final Lock serviceWriteLock = getServiceLock().writeLock();
+        final HashMap context = new HashMap();
+
+        final DateTime now = new DateTime(ISOChronology.getInstanceUTC());
         lastReloadInstant = now;
 
         try {
@@ -176,12 +179,15 @@
     /**
      * Called by the {@link ServiceReloadTask} to determine if the service should be reloaded.
      * 
-     * @return true if the service should be reloaded, false if not
+     * <p>No lock is held when this method is called, so any locking needed should be handled
+     * internally.</p>
+     * 
+     * @return true iff the service should be reloaded
      */
     protected abstract boolean shouldReload();
 
     /** {@inheritDoc} */
-    protected void doPreStop(final HashMap context) throws ServiceException {
+    protected void doPreStop(@Nonnull final HashMap context) throws ServiceException {
         reloadTask.cancel();
         super.doPreStop(context);
     }
@@ -197,7 +203,7 @@
      * 
      * @throws ServiceException thrown if there is a problem reloading the service
      */
-    protected void doPreReload(final HashMap context) throws ServiceException {
+    protected void doPreReload(@Nonnull final HashMap context) throws ServiceException {
         log.debug("Reloading service '{}'", getId());
 
     }
@@ -213,7 +219,7 @@
      * 

[... 515 lines stripped ...]


More information about the commits mailing list