java - Are there dangers to throwing a runtime exception forcibly into a thread with Thread.stop(Throwable)? -


i writing large, multithreaded application, many differing roles threads (e.g. event processing, metrics, networking). currently, if there inconsistency cannot handled, manifest exception. since there's no way recover of them, i've been rethrowing runtime exception of type applicationdeathexception.

any classes need handle shutdown call catch block exception, , rethrow in order propagate stack).

i considering killing off other threads in same manner calling thread#stop(throwable) upon them. fine sudden termination, , can catch exception should there need shutdown logic. have exception propagate stack, performing shutdown logic whereever needed, , killing thread in end. there hidden dangers i'm missing approach?

thread.stop has been deprecated since unsafe (see javadoc). instead have each thread monitor boolean flag of sort (see java: how stop thread? , countless other threads on so).

in situations typically implement sort of thread pool manager responsible cleanly shutting down running threads. when bad happens need notify manager shut things down.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -