[
https://issues.apache.org/jira/browse/IVY-585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
John Gill updated IVY-585:
--------------------------
Description:
I would like to request an implementation of interrupt in the Ivy class that
can not call stop on the operatingThread. I am hitting issues trying to
interrupt the resolve from a job in an eclipse plugin. I am seeing a
ThreadDeath exception in the uncaughtExceptionHandler and then a hung thread.
I would like propose an interruptedSafely that basically just set interrupted
to true. This will allow monitoring the operating thread until it terminates
without a stop.
{code:java}
/**
* Marks the current running operation as interrupted. The processing will
eventually call
* checkInterrupted and end safely.
*/
public void interruptSafely(Thread operatingThread) {
if (operatingThread != null && operatingThread.isAlive()) {
if (operatingThread == Thread.currentThread()) {
throw new IllegalStateException("cannot call interrupt from ivy
operating thread");
}
Message.verbose("interrupting operating thread...");
interrupted = true;
}
}
{code}
Another option would be to offer getter/setters on the interrupted boolean.
Interrupted could then be set and checkInterrupted would end the resolve. Since
stop is not the recommended way to stop a thread, it would be nice to have a
way to interrupt the resolve that can not call stop.
was:
I would like to request an implementation of interrupt in the Ivy class that
can not call stop on the operatingThread. I am hitting issues trying to
interrupt the resolve from a job in an eclipse plugin. I am seeing a
ThreadDeath exception in the uncaughtExceptionHandler and then a hung thread.
I would like propose an interruptedSafely that basically just set interrupted
to true. This will allow monitoring the operating thread until it terminates
without a stop.
/**
* Marks the current running operation as interrupted. The processing will
eventually call
* checkInterrupted and end safely.
*/
public void interruptSafely(Thread operatingThread) {
if (operatingThread != null && operatingThread.isAlive()) {
if (operatingThread == Thread.currentThread()) {
throw new IllegalStateException("cannot call interrupt from ivy
operating thread");
}
Message.verbose("interrupting operating thread...");
interrupted = true;
}
}
Another option would be to offer getter/setters on the interrupted boolean.
Interrupted could then be set and checkInterrupted would end the resolve. Since
stop is not the recommended way to stop a thread, it would be nice to have a
way to interrupt the resolve that can not call stop.
> Add an interruptSafely to Ivy
> -----------------------------
>
> Key: IVY-585
> URL: https://issues.apache.org/jira/browse/IVY-585
> Project: Ivy
> Issue Type: Improvement
> Components: Core
> Affects Versions: 2.0.0-alpha-2
> Reporter: Jim Bonanno
>
> I would like to request an implementation of interrupt in the Ivy class that
> can not call stop on the operatingThread. I am hitting issues trying to
> interrupt the resolve from a job in an eclipse plugin. I am seeing a
> ThreadDeath exception in the uncaughtExceptionHandler and then a hung thread.
> I would like propose an interruptedSafely that basically just set interrupted
> to true. This will allow monitoring the operating thread until it terminates
> without a stop.
> {code:java}
> /**
> * Marks the current running operation as interrupted. The processing will
> eventually call
> * checkInterrupted and end safely.
> */
> public void interruptSafely(Thread operatingThread) {
> if (operatingThread != null && operatingThread.isAlive()) {
> if (operatingThread == Thread.currentThread()) {
> throw new IllegalStateException("cannot call interrupt from
> ivy operating thread");
> }
> Message.verbose("interrupting operating thread...");
> interrupted = true;
> }
> }
> {code}
> Another option would be to offer getter/setters on the interrupted boolean.
> Interrupted could then be set and checkInterrupted would end the resolve.
> Since stop is not the recommended way to stop a thread, it would be nice to
> have a way to interrupt the resolve that can not call stop.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.