The setTimeout method of the Session class establishes the period of time that can elapse before the session becomes invalid.
public void setTimeout(int timeout);