Its kind of sad there is no solution to this after all of this time. Gosh Java sucks... ;-) I'm sure it all works perfectly in NuFuBarX lang...we must migrate JBoss immediately.

Adrian Brock wrote:
On Sat, 2006-02-04 at 17:44, Scott M Stark wrote:

It was the only way I found to implement a timeout behavior that had a
chance of working when there were uncooperative tasks. See the
org.jboss.test.util.test.
ThreadPoolTaskUnitTestCase.testCompleteTimeoutWithSpinLoop as an
example.


There is no real solution to that problem in java.
CPU loops don't respond to thread interrupts.

You can't even redefineClass() to add a Thread.interrupted()
check in the misbehaving method, because it won't take affect on that
invocation.

Stopping the thread will avoid the cpu utilization problem,
but your JVM is now in an unknown/unstable state.

Connection c = dataSource.getConnection();
try
{
   synchronized (lock)
   {
      spin(); // ---> Stop
   }
}
finally
{
   c.close(); // Never done
}

The connection leaks, I don't know what happens to the lock?

A better solution would be to "automatically" trigger a reboot if you
detect a misbehaving thread.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Adrian Brock
Sent: Saturday, February 04, 2006 2:33 PM
To: jboss-development@lists.sourceforge.net
Subject: [JBoss-dev] BasicThreadPool and Thread.stop()

I don't think it is a good idea to invoke Thread.stop().
This has memory leak problems.

Why was this introduced? The pooled threads are already daemon threads
so they should not stop the system from exiting at shutdown.

If you are not shutting down the system, then any objects
on the stopped thread's stack are not garbage collected.




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to