dk.i1.diameter.session
Class SessionAuthTimers

Object
  extended by dk.i1.diameter.session.SessionAuthTimers

public class SessionAuthTimers
extends Object

Authorization time calculator. This utility class keeps track of the authorization-lifetime and authorization-grace-period and calculates when the session must be close or when a re-authorization must be sent.


Constructor Summary
SessionAuthTimers()
           
 
Method Summary
 long getMaxTimeout()
          Retrieve the maximum timeout of the session after which service must be denied and the session should be closed.
 long getNextReauthTime()
          Retrieve the calculated time for the next re-authorization.
 void updateTimers(long auth_time, long auth_lifetime, long auth_grace_period)
          Updates the calculations based on the supplied values.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionAuthTimers

public SessionAuthTimers()
Method Detail

updateTimers

public void updateTimers(long auth_time,
                         long auth_lifetime,
                         long auth_grace_period)
Updates the calculations based on the supplied values. The method will try to schedule the re-authorization (if any) 10 seconds before the session would have to be closed otherwise.

Parameters:
auth_time - The time then the authorization succeeded (absolute, milliseconds). Ideally, this should be the time when the users is given service (for the first authorization), and the server's time when the re-authorization succeeds. In most cases System.currentTimeMillis() will do.
auth_lifetime - The granted authorization lifetime in relative milliseconds. Use 0 to specify no authorization-lifetime.
auth_grace_period - The authorization-grace-period in relative milliseconds. Use 0 to specify none.

getNextReauthTime

public long getNextReauthTime()
Retrieve the calculated time for the next re-authorization.

Returns:
The next re-authorization time, in milliseconds. Will be Long.MAX_VALUE if there is none.

getMaxTimeout

public long getMaxTimeout()
Retrieve the maximum timeout of the session after which service must be denied and the session should be closed.

Returns:
The timeout. Will be Long.MAX_VALUE if there is no timeout.