Time out method in java
<p>In a java class I have a method that sometimes takes a long time for execution. Maybe it hangs in that method flow. What I want is if the method doesn't complete in specific time, the program should exit from that method and continue with the rest of flow.</p>

<p>Please let me know is there any way to handle this situation.</p>
