You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2010/04/09 01:32:27 UTC
svn commit: r932178 -
/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
Author: rwatler
Date: Thu Apr 8 23:32:27 2010
New Revision: 932178
URL: http://svn.apache.org/viewvc?rev=932178&view=rev
Log:
JS2-1183: shutdown ResourceRemovalCache thread
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java?rev=932178&r1=932177&r2=932178&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java Thu Apr 8 23:32:27 2010
@@ -44,9 +44,33 @@ public class ResourceRemovalCache extend
this.scanRateSeconds = scanRateSeconds;
this.msTimeToLive = timeToLiveSeconds * 1000;
}
+
public void setStopping(boolean flag)
{
- this.stopping = flag;
+ // stop this removal thread
+ synchronized (this)
+ {
+ if (!stopping && flag)
+ {
+ stopping = flag;
+ notifyAll();
+ }
+ else
+ {
+ flag = false;
+ }
+ }
+ // wait for removal thread to stop
+ if (flag)
+ {
+ try
+ {
+ join(scanRateSeconds * 1000);
+ }
+ catch (InterruptedException ie)
+ {
+ }
+ }
}
public void insert(RemovableResource r)
@@ -59,6 +83,9 @@ public class ResourceRemovalCache extend
public void shutdown()
{
+ // stop removal thread
+ setStopping(true);
+ // final traverse to delete all
traverse(true);
}
@@ -66,12 +93,12 @@ public class ResourceRemovalCache extend
* Run the file scanner thread
*
*/
- public void run()
+ public synchronized void run()
{
traverse(false);
}
- protected void traverse(boolean deleteAll)
+ protected synchronized void traverse(boolean deleteAll)
{
boolean done = false;
try
@@ -132,7 +159,7 @@ public class ResourceRemovalCache extend
}
if (!done)
- sleep(scanRateSeconds * 1000);
+ wait(scanRateSeconds * 1000);
if (this.stopping)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org