how to implement timeout in java to see whether the response come
<p>I have a two functions, one is the master and the other is the slave. Via master function I'm trying to learn behaviour of the other function. But I should do whatever calculation is a setted time interval. In this part, how can I set a timer, which is marked a boolean variable if timeout occur, and learn whether timeout occurs ? </p>

<pre><code>func1   -----send message------&gt;   func2  
             start timer
             if timeout occur, do something else
</code></pre>
