Integrated r2022: Forum Timer is now a daemon thread so that Tomcat stops gracefully

git-svn-id: https://svn.libreccm.org/ccm/trunk@282 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2009-11-02 10:23:15 +00:00
parent 073aeea9c1
commit 00f45e193e
1 changed files with 12 additions and 7 deletions

View File

@ -44,17 +44,17 @@ import com.arsdigita.util.UncheckedWrapperException;
* halfway through making a new post * halfway through making a new post
* *
* @author Chris Gilbert(chris.gilbert@westsussex.gov.uk) * @author Chris Gilbert(chris.gilbert@westsussex.gov.uk)
* @version $Revision: 1.1 $ $DateTime: 2004/08/17 23:15:09 $ * @version $Id: RemoveUnattachedAssetsScheduler.java,v 1.1 2006/07/13 10:19:28 cgyg9330 Exp $
*/ */
public class RemoveUnattachedAssetsScheduler { public class RemoveUnattachedAssetsScheduler {
public static final String versionId = "$Id: RemoveUnattachedAssetsScheduler.java,v 1.1 2006/07/13 10:19:28 cgyg9330 Exp $ by $Author: cgyg9330 $, $DateTime: 2004/08/17 23:15:09 $";
// For storing timer which runs a method periodically to fire // For storing timer which runs a method periodically to fire
// begin and end events // begin and end events
private static Timer s_Timer; private static Timer s_Timer;
// if process runs very very slowly, prevent duplicate attempt fro mrunning before the first one ends // if process runs very very slowly, prevent duplicate attempt from
// running before the first one ends
private static boolean s_running = false; private static boolean s_running = false;
private static Logger s_log = private static Logger s_log =
@ -70,7 +70,15 @@ public class RemoveUnattachedAssetsScheduler {
} }
// Timer triggers straight away, and then every 24 hours // Timer triggers straight away, and then every 24 hours
// don't run timer as a daemon - if server stops, kill this process too, as no one will be creating new posts // don't run timer as a daemon - if server stops, kill this process
// too, as no one will be creating new posts
// s_Timer = new Timer(true);
// Problem as with version 6.6 / rev. 2021 and earlier:
// The tomcat shutdown command does not finish completely. Several
// background processes prevent a clean shutdown. Details have to be
// figured out yet (Nov. 2, 2009)
// Timer is now a daemon thread so that Tomcat stops gracefully
s_Timer = new Timer(false); s_Timer = new Timer(false);
s_Timer.scheduleAtFixedRate(new RemoveUnattachedAssetsTask(), 0, 1000 * 60 * 60 * 24); s_Timer.scheduleAtFixedRate(new RemoveUnattachedAssetsTask(), 0, 1000 * 60 * 60 * 24);
@ -109,7 +117,4 @@ public class RemoveUnattachedAssetsScheduler {
} }
} }