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 00:41:28 UTC
svn commit: r932155 -
/portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/main/java/org/apache/jetspeed/cache/file/FileCache.java
Author: rwatler
Date: Thu Apr 8 22:41:27 2010
New Revision: 932155
URL: http://svn.apache.org/viewvc?rev=932155&view=rev
Log:
JS2-1183: shutdown FileCacheScanner thread
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/main/java/org/apache/jetspeed/cache/file/FileCache.java
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/main/java/org/apache/jetspeed/cache/file/FileCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/main/java/org/apache/jetspeed/cache/file/FileCache.java?rev=932155&r1=932154&r2=932155&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/main/java/org/apache/jetspeed/cache/file/FileCache.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/main/java/org/apache/jetspeed/cache/file/FileCache.java Thu Apr 8 22:41:27 2010
@@ -291,14 +291,37 @@ public class FileCache
public void setStopping(boolean flag)
{
- this.stopping = flag;
+ // stop this scanning thread
+ synchronized (this)
+ {
+ if (!stopping && flag)
+ {
+ stopping = flag;
+ notifyAll();
+ }
+ else
+ {
+ flag = false;
+ }
+ }
+ // wait for scanning thread to stop
+ if (flag)
+ {
+ try
+ {
+ join(FileCache.this.getScanRate() * 1000);
+ }
+ catch (InterruptedException ie)
+ {
+ }
+ }
}
/**
* Run the file scanner thread
*
*/
- public void run()
+ public synchronized void run()
{
boolean done = false;
@@ -337,7 +360,7 @@ public class FileCache
log.error("FileCache Scanner: Error in iteration...", e);
}
- sleep(FileCache.this.getScanRate() * 1000);
+ wait(FileCache.this.getScanRate() * 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