dk.i1.diameter.session
Interface Session

All Known Implementing Classes:
AASession, BaseSession

public interface Session

The session interface is what the SessionManager operates on

See Also:
BaseSession

Method Summary
 long calcNextTimeout()
          Calculate the next timeout for this session, if any.
 void handleAnswer(Message answer, Object state)
          This method is called when the SessionManager has received an answer regarding this session.
 void handleNonAnswer(int command_code, Object state)
          This method is called when the SessionManager did not receive an answer.
 int handleRequest(Message request)
          This method is called when the SessionManager has received a request for this session.
 void handleTimeout()
          Handle timeouts, if any.
 String sessionId()
          sessionId() is called by the SessionManager (and other classes) to obtain the Diameter Session-Id of the session.
 

Method Detail

sessionId

String sessionId()
sessionId() is called by the SessionManager (and other classes) to obtain the Diameter Session-Id of the session. The BaseSession class implements this by following RFC3588 section 8.8

Returns:
The stable, eternally unique session-id of the session

handleRequest

int handleRequest(Message request)
This method is called when the SessionManager has received a request for this session.

Parameters:
request - The Diameter request for this session.
Returns:
the Diameter result-code (RFC3588 section 7.1)

handleAnswer

void handleAnswer(Message answer,
                  Object state)
This method is called when the SessionManager has received an answer regarding this session.

Parameters:
answer - The Diameter answer for this session.
state - The state specified in the SessionManager.sendRequest(dk.i1.diameter.Message, dk.i1.diameter.session.Session, java.lang.Object) call.

handleNonAnswer

void handleNonAnswer(int command_code,
                     Object state)
This method is called when the SessionManager did not receive an answer.

Parameters:
command_code - The command_code in the original request.
state - The state specified in the SessionManager.sendRequest(dk.i1.diameter.Message, dk.i1.diameter.session.Session, java.lang.Object) call.

calcNextTimeout

long calcNextTimeout()
Calculate the next timeout for this session, if any. This method is called by the SessionManager at appropriate times in order to calculate when handleTimeouts() should be called.

Returns:
Next absolute timeout in milliseconds. Long.MAX_VAUE if none.

handleTimeout

void handleTimeout()
Handle timeouts, if any. This method is called by the Sessionmanager when it thinks that a timeout has expired for the session. The session can take any action it deems appropriate. The method may be called when no timeouts has expired so the implementation should not get upset about that.