User: jules_gosnell
Date: 02/02/12 17:03:06
Modified: jetty/src/main/org/jboss/jetty/util NaiveTimeOutManager.java
Log:
ensure that background threads get tidied up if Jetty is bounced
Revision Changes Path
1.6 +22 -14
contrib/jetty/src/main/org/jboss/jetty/util/NaiveTimeOutManager.java
Index: NaiveTimeOutManager.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/util/NaiveTimeOutManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NaiveTimeOutManager.java 1 Feb 2002 19:12:03 -0000 1.5
+++ NaiveTimeOutManager.java 13 Feb 2002 01:03:06 -0000 1.6
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: NaiveTimeOutManager.java,v 1.5 2002/02/01 19:12:03 jules_gosnell Exp $
+// $Id: NaiveTimeOutManager.java,v 1.6 2002/02/13 01:03:06 jules_gosnell Exp $
//------------------------------------------------------------------------------
@@ -109,31 +109,39 @@
volatile boolean _loop=true;
+ protected int _started=0;
+
public synchronized void
start()
{
- new Thread() {
- public void
- run()
- {
- while (_loop)
+ if (_started<1)
+ {
+ new Thread() {
+ public void
+ run()
{
- try
+ while (_loop)
{
- sleep(_interval);
- sweep();
+ try
+ {
+ sleep(_interval);
+ sweep();
+ }
+ catch (InterruptedException e)
+ {}
}
- catch (InterruptedException e)
- {}
}
- }
- }.start();
+ }.start();
+ }
+ _started++;
}
public synchronized void
stop()
{
- _loop=false;
+ _started--;
+ if (_started<1)
+ _loop=false;
}
void
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development