Java threads: Is it possible view/pause/kill a particular thread from a different java program running on the same JVM?

前端 未结 4 847
日久生厌
日久生厌 2020-12-10 07:15

I have a program \'foo\' running different threads, fooT1, fooT2, .. fooTn.

Now if I want write another program \'bar\', which could kill the thread fooTr, is that p

4条回答
  •  猫巷女王i
    2020-12-10 07:33

    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 RMI.

提交回复
热议问题