What can be the best technique to Terminate the Execution of Program based on some event in Java
<p>I am designing a Card based Game in Java. I have implemented the game logic. It is working fine. Now I want to add a functionality which can check for the time player is playing the game. If the time goes above a threshold limit, I want to terminate the Execution of Game. Please suggest me what should be the best strategy to implement this feature?  Is creating a Thread and checking the time a good technique or there is any other technique to achieve this?</p>

<p>Edit: Sorry for the vague description.What I want to implement is, no matter where the player is in the execution sequence, when the time limit reaches, program should terminate. If i implement the check at the looping condition, then if the time is still left, program will continue and complete the set of instructions in the loop, but if the time is over even if the program is entered into the execution loop, it should stop doing whatever it is doing. This is what i want to implement. </p>

<p>Thanks,
Tara Singh</p>
