endSession
endSession(String
sessionID
)
endSession
メソッドは、ランタイム・セッション終了のマークを付けます。 ランタイム・サーバーは、このメソッドを受信すると、履歴へのログの記録やメモリーのクリアなどを行います。
sessionID
— セッションを識別する一意の文字列。
endSession メソッドが呼び出されない場合、ランタイム・セッションはタイムアウトになります。 タイムアウト期間は、
sessionTimeout
プロパティーを使用して構成可能です。
戻り値
ランタイム・サーバーは、以下の属性が設定された
Response
オブジェクトを使用して
endSession
メソッドに応答します。
SessionID
ApiVersion
StatusCode
AdvisoryMessages
例
以下の例は、
endSession
メソッドと、応答を解析する方法を示します。
sessionId
は、このセッションを開始した
startSession
呼び出しで使用されるセッションを識別する同じ文字列です。
response = api.endSession(sessionId);
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
{
System.out.println("endSession call processed with no warnings or errors");
}
else if(response.getStatusCode() == Response.STATUS_WARNING)
{
System.out.println("endSession call processed with a warning");
}
else
{
System.out.println("endSession call processed with an error");
}
// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)
printDetailMessageOfWarningOrError("endSession",
response.getAdvisoryMessages());
Copyright IBM Corporation 2012. All Rights Reserved.