TL;DR Is it OK to a Java thread when I know it isn't synchronized to anything else?
First I'll describe my predicament. I have a service that handles requests from an app (both on the same machine). This service is single threaded. In some cases, answering requests can take a while. I'd like to time out the request in those cases. Sadly, it's quite complicated to poll interrupts inside said service, as it has quite expansive algorithmic logic, and would cause lots of ugly code rewriting.
Think of the service as a facade that calls a library of scary algorithmic stuff. Currently the service simply calls the library upon request, I want it to start a thread, and time it out if computation takes too long. I intend on using just a single extra thread.
I read How do you kill a thread in Java? and https://docs.oracle.com/javase/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html
According to these, stopping a thread is deprecated because of loss of synchronization. However, my service is basically single threaded, and thus has no need for synchronization.
In this case, is it OK for me to stop the thread? Am I missing some internal java stuff?
Thanks!