To my knowledge it is not possible to do this directly. What you could consider however is to create some kind of service on your 'foo' that can be called from 'bar' to kill the thread. There are, of course, hundreds of ways to implement this. My first thought would be to do this using RMIRMI.
corrected spelling of course, and turned RMI into a link to search for java RMI on stackoverflow (mostly because "edits must be at least 6 characters" kept the spelling correction for "course" from being accepted independently)
Tim Lewis
- 3.5k
- 1
- 39
- 26