[jboss-cvs] JBossAS SVN: r94425 - in branches/Branch_5_x/security/src/main/org/jboss/security: plugins and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 6 13:52:47 EDT 2009


Author: mmoyses
Date: 2009-10-06 13:52:47 -0400 (Tue, 06 Oct 2009)
New Revision: 94425

Modified:
   branches/Branch_5_x/security/src/main/org/jboss/security/integration/JNDIBasedSecurityManagement.java
   branches/Branch_5_x/security/src/main/org/jboss/security/plugins/JaasSecurityManagerService.java
Log:
JBAS-3986: enabling the thread to be started/stopped at runtime

Modified: branches/Branch_5_x/security/src/main/org/jboss/security/integration/JNDIBasedSecurityManagement.java
===================================================================
--- branches/Branch_5_x/security/src/main/org/jboss/security/integration/JNDIBasedSecurityManagement.java	2009-10-06 16:25:44 UTC (rev 94424)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/integration/JNDIBasedSecurityManagement.java	2009-10-06 17:52:47 UTC (rev 94425)
@@ -346,6 +346,16 @@
    public static void setDefaultCacheFlushPeriod(int flushPeriodInSecs)
    {
       SecurityConstantsBridge.defaultCacheFlushPeriod = flushPeriodInSecs;
+      if (SecurityConstantsBridge.defaultCacheFlushPeriod == 0 && authCacheFlushThread != null)
+      {
+         authCacheFlushThread.interrupt();
+         authCacheFlushThread = null;
+      }
+      if (SecurityConstantsBridge.defaultCacheFlushPeriod > 0 && authCacheFlushThread == null)
+      {
+         authCacheFlushThread = new AuthenticationCacheFlushThread(securityMgrMap);
+         authCacheFlushThread.start();
+      }
    }
 
    @ManagementOperation(description = "Create the context for the specified security domain",
@@ -584,7 +594,7 @@
    public void start()
    {
       // start the authentication cache flush thread
-      if (SecurityConstantsBridge.defaultCacheFlushPeriod > 0)
+      if (SecurityConstantsBridge.defaultCacheFlushPeriod > 0 && authCacheFlushThread == null)
       {
          authCacheFlushThread = new AuthenticationCacheFlushThread(securityMgrMap);
          authCacheFlushThread.start();
@@ -594,6 +604,9 @@
    public void stop()
    {
       if (authCacheFlushThread != null)
+      {
          authCacheFlushThread.interrupt();
+         authCacheFlushThread = null;
+      }
    }
 }

Modified: branches/Branch_5_x/security/src/main/org/jboss/security/plugins/JaasSecurityManagerService.java
===================================================================
--- branches/Branch_5_x/security/src/main/org/jboss/security/plugins/JaasSecurityManagerService.java	2009-10-06 16:25:44 UTC (rev 94424)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/plugins/JaasSecurityManagerService.java	2009-10-06 17:52:47 UTC (rev 94425)
@@ -316,7 +316,7 @@
    public void setDefaultCacheFlushPeriod(int flushPeriodInSecs)
    {
       this.defaultCacheFlushPeriod = flushPeriodInSecs;
-      SecurityConstantsBridge.defaultCacheFlushPeriod = flushPeriodInSecs;
+      JNDIBasedSecurityManagement.setDefaultCacheFlushPeriod(flushPeriodInSecs);
    }
 
    /** flush the cache policy for the indicated security domain if one exists.




More information about the jboss-cvs-commits mailing list