blob: 818439c5477ffceebad99b0ec86dcb771352d3d2 (
plain) (
tree)
|
|
package org.openslx.imagemaster.serversession;
/**
* Holds the session id of the server and manages the timeout.
* @author nils
*
*/
public class ServerSession {
private static final long TIMEOUT = 600L * 1000L; // TODO: config
private long timeOut = 0;
private final ServerUser serverUser;
public ServerSession(final ServerUser serverUser)
{
this.serverUser = serverUser;
this.timeOut = System.currentTimeMillis() + TIMEOUT;
}
public synchronized void refresh()
{
if ( timedOut() )
return; // Don't allow refreshing timed out session
this.timeOut = System.currentTimeMillis() + TIMEOUT;
}
public synchronized boolean timedOut()
{
return System.currentTimeMillis() > this.timeOut;
}
public String getOrganization() {
return serverUser.organization;
}
public String getAddress() {
return serverUser.address;
}
}
|