avalon-phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrei Ivanov" <my...@surfeu.fi>
Subject Correct way to interrupt threads in dispose...
Date Wed, 22 May 2002 22:48:02 GMT
Hi,
In my Phoenix block I am using threads in the following way:

member:
LinkedList threads = new LinkedList();

in initialize():

ThreadPool workerPool = threadManager.getThreadPool("default");
...
for ( int i = 0 ; i < nthreads ; i++ ) {
      ThreadControl tc = workerPool.execute(this);
      threads.add(tc);
}
...

when it is time do dispose I have the following lines inside dispose():

    for (Iterator i = threads.iterator(); i.hasNext(); ) {
      ThreadControl tc = (ThreadControl)i.next();
      tc.interupt();
    }
    notifyAll();

Today, after updating cornerstone and phoenix I've got exception upon
Phoenix shutdown:

org.apache.avalon.phoenix.components.lifecycle.LifecycleException: Component
named "xxxxx" failed to pass through the Disposing stage. (Reason:
java.lang.IllegalMonitorStateException: current thread not owner).
        at
org.apache.avalon.phoenix.components.lifecycle.LifecycleHelper.fail(Lifecycl
eHelper.java:280)
        at
org.apache.avalon.phoenix.components.lifecycle.LifecycleHelper.shutdown(Life
cycleHelper.java:221)

What is wrong with my dispose() in respect of latest changes in cornerstone
and phoenix?

Andrei






--
To unsubscribe, e-mail:   <mailto:avalon-phoenix-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-phoenix-dev-help@jakarta.apache.org>


Mime
View raw message