|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.service.session.ClientSessionHandler
class ClientSessionHandler
Handles sending/receiving messages to/from a client session and disconnecting a client session.
| Nested Class Summary | |
|---|---|
(package private) class |
ClientSessionHandler.DisconnectAction
An action to disconnect the client session. |
(package private) class |
ClientSessionHandler.MoveAction
An action to start the process of moving the associated client session from this node to another node (the newNode
specified during construction). |
(package private) class |
ClientSessionHandler.SendMessageAction
An action to send a message. |
(package private) static class |
ClientSessionHandler.SetupCompletionFuture
This future is constructed with the RequestCompletionHandler
passed to one of the ProtocolListener's methods: newLogin or relocatedSession. |
| Field Summary | |
|---|---|
(package private) Identity |
identity
The identity for this session. |
(package private) static String |
RELOCATE_REFUSED_REASON
Message indicating relocation was refused for a non-specific reason. |
(package private) BigInteger |
sessionRefId
The session ID as a BigInteger. |
| Constructor Summary | |
|---|---|
ClientSessionHandler(ClientSessionServiceImpl sessionService,
DataService dataService,
SessionProtocol sessionProtocol,
Identity identity,
RequestCompletionHandler<SessionProtocolHandler> completionHandler)
Constructs an handler for a client session that is logging in. |
|
ClientSessionHandler(ClientSessionServiceImpl sessionService,
DataService dataService,
SessionProtocol sessionProtocol,
Identity identity,
RequestCompletionHandler<SessionProtocolHandler> completionHandler,
BigInteger sessionRefId)
Constructs an handler for a client session. |
|
| Method Summary | |
|---|---|
void |
channelMessage(BigInteger channelId,
ByteBuffer message,
RequestCompletionHandler<Void> completionHandler)
Processes a channel message sent by the associated client on the channel with the specified channelId, and invokes the
completed method on the
given completionHandler when this handler has completed
processing the channel message. |
void |
disconnect(RequestCompletionHandler<Void> completionHandler)
Notifies this handler that a non-graceful client disconnection has occurred, and invokes the completed method on the given completionHandler when this
handler has completed processing the disconnection. |
(package private) SessionProtocol |
getSessionProtocol()
Returns the protocol for the associated client session, or null if the session is relocating. |
(package private) void |
handleDisconnect(boolean graceful,
boolean closeConnection)
Handles disconnecting the associated client session (if not already handled) by doing the following: notifies the client session service to clean up the client session's handler and login information, notifies the node mapping service to deativate the client's identity if the identity is no longer active on this node, if closeConnection is true, closes this
session's connection,
if the session is terminating (not relocating), schedules a
transactional task to invoke, on this session's ClientSessionListener, the disconnected callback
with graceful as its argument and then clean up the
session's persistent data, and also schedules a task to notify
the identity that its corresponding session has logged out. |
(package private) boolean |
isConnected()
Returns true if this handler is connected, otherwise
returns false. |
(package private) boolean |
isRelocating()
Returns true if this client session has begun preparing to
relocate, or has relocated to another node. |
(package private) boolean |
loginHandled()
Returns true if the login for this session has been handled,
otherwise returns false. |
void |
logoutRequest(RequestCompletionHandler<Void> completionHandler)
Processes a logout request from the associated client, and invokes the completed method on the
given completionHandler when this handler has completed
processing the logout request. |
void |
sessionMessage(ByteBuffer message,
RequestCompletionHandler<Void> completionHandler)
Processes a message sent by the associated client, and invokes the completed method on the
given completionHandler when this handler has completed
processing the message. |
(package private) void |
setRelocatePreparationComplete()
Indicates that all parties are done with relocation preparation, and notifies the client that it should suspend messages (before notifying the client to relocate to another node). |
(package private) void |
shutdown()
Flags this session as shut down, and closes the connection. |
(package private) boolean |
supportsRelocation()
Returns true if this session's protocol handler supports
relocation (i.e., implements the SessionRelocationProtocol
interface; otherwise returns false. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final String RELOCATE_REFUSED_REASON
volatile BigInteger sessionRefId
final Identity identity
| Constructor Detail |
|---|
ClientSessionHandler(ClientSessionServiceImpl sessionService,
DataService dataService,
SessionProtocol sessionProtocol,
Identity identity,
RequestCompletionHandler<SessionProtocolHandler> completionHandler)
sessionService - the ClientSessionService instancedataService - the DataService instancesessionProtocol - a session protocolidentity - an identitycompletionHandler - a completion handler for the associated
request
ClientSessionHandler(ClientSessionServiceImpl sessionService,
DataService dataService,
SessionProtocol sessionProtocol,
Identity identity,
RequestCompletionHandler<SessionProtocolHandler> completionHandler,
BigInteger sessionRefId)
sessionRefId
is non-null, then the associated client session is relocating
from another node, otherwise it is considered a new client session
logging in.
sessionService - the ClientSessionService instancedataService - the DataService instancesessionProtocol - a session protocolidentity - an identitycompletionHandler - a completion handler for the associated
requestsessionRefId - the client session ID, or null| Method Detail |
|---|
public void sessionMessage(ByteBuffer message,
RequestCompletionHandler<Void> completionHandler)
completed method on the
given completionHandler when this handler has completed
processing the message. The message starts at the buffer's current
position and ends at the buffer's limit. The buffer's position is
not modified by this operation.
The ByteBuffer may be reused immediately after this method
returns. Changes made to the buffer after this method returns will
have no effect on the message supplied to this method.
sessionMessage in interface SessionProtocolHandlermessage - a messagecompletionHandler - a completion handler
public void channelMessage(BigInteger channelId,
ByteBuffer message,
RequestCompletionHandler<Void> completionHandler)
channelId, and invokes the
completed method on the
given completionHandler when this handler has completed
processing the channel message. The message starts at the buffer's
current position and ends at the buffer's limit. The buffer's position
is not modified by this operation.
The ByteBuffer may be reused immediately after this method
returns. Changes made to the buffer after this method returns will
have no effect on the message supplied to this method.
channelMessage in interface SessionProtocolHandlerchannelId - a channel IDmessage - a messagecompletionHandler - a completion handlerpublic void logoutRequest(RequestCompletionHandler<Void> completionHandler)
completed method on the
given completionHandler when this handler has completed
processing the logout request.
logoutRequest in interface SessionProtocolHandlercompletionHandler - a completion handlerpublic void disconnect(RequestCompletionHandler<Void> completionHandler)
completed method on the given completionHandler when this
handler has completed processing the disconnection.
disconnect in interface SessionProtocolHandlercompletionHandler - a completion handlerpublic String toString()
toString in class Objectboolean isConnected()
true if this handler is connected, otherwise
returns false.
true if this handler is connectedboolean supportsRelocation()
true if this session's protocol handler supports
relocation (i.e., implements the SessionRelocationProtocol
interface; otherwise returns false.
boolean isRelocating()
true if this client session has begun preparing to
relocate, or has relocated to another node.
void setRelocatePreparationComplete()
SessionProtocol getSessionProtocol()
null if the session is relocating.
null if the session is relocatingboolean loginHandled()
true if the login for this session has been handled,
otherwise returns false.
true if the login for this session has been handled
void handleDisconnect(boolean graceful,
boolean closeConnection)
closeConnection is true, closes this
session's connection,
ClientSessionListener, the disconnected callback
with graceful as its argument and then clean up the
session's persistent data, and also schedules a task to notify
the identity that its corresponding session has logged out.
Note:if graceful is true, then closeConnection must be false so that the client's SessionProtocol can send a notification of logout success to the
client. The client may not receive such a notification if the
connection is disconnected immediately.
In the cases of login redirection, session relocation, and
graceful logout, it is the responsibility of the client's SessionProtocol to close the client's connection in a timely manner
after notifying the client.
graceful - if true, indicates that disconnection is
due to a (graceful) logout requestcloseConnection - if true, close this session's
connection immediatelyvoid shutdown()
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||