These are some possible ways:
Using session :
- use System.currentTimeMillis(); that contains server time when the
request occurs
- Or use sessoin timeout and do something where session is going to be
invalidated.
also might be better to use connection, depends on your appliation.