com.sun.sgs.impl.service.session
Class ClientSessionHandler.MoveAction

java.lang.Object
  extended by com.sun.sgs.impl.service.session.ClientSessionHandler.MoveAction
All Implemented Interfaces:
ClientSessionServiceImpl.Action, SimpleCompletionHandler
Enclosing class:
ClientSessionHandler

 class ClientSessionHandler.MoveAction
extends Object
implements ClientSessionServiceImpl.Action, SimpleCompletionHandler

An action to start the process of moving the associated client session from this node to another node (the newNode specified during construction). This commit action is created by the associated session's ClientSessionImpl when processing a request to move the client to a new node.

When this action is executed, it sends a relocatingSession notification to the new node's ClientSessionServer to obtain a relocation key for the client session. Once the relocation key is obtained, it notifies the client session service to notify all registered ClientSessionStatusListeners (i.e., the ChannelService) to prepare to relocate the client session.

When all ClientSessionStatusListeners have completed preparing the client session to relocate, this instance's suspend method is invoked which notifies the associated session's SessionProtocol to suspend sending messages to the server.

When the suspend operation's SuspendCompletionHandler is notified as completed, that completion handler notifies this action's completed method, which, in turn notifies the associated session's SessionProtocol to relocate the client's connection, supplying the new node's information and the relocation key.


Constructor Summary
ClientSessionHandler.MoveAction(Node newNode)
          Constructs an instance with the specified newNode.
 
Method Summary
 void completed()
          Notifies this handler that the operations initiated by the request associated with this future are complete.
 boolean flush()
          Performs the commit action and returns true if further actions should be processed after this one, and returns false otherwise.
 boolean isCompleted()
          Returns true if relocation preparation is completed.
 void suspend()
          Suspends messages to the client before sending the 'relocate' notification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientSessionHandler.MoveAction

ClientSessionHandler.MoveAction(Node newNode)
Constructs an instance with the specified newNode.

Parameters:
newNode - the new node for the session
Method Detail

flush

public boolean flush()
Performs the commit action and returns true if further actions should be processed after this one, and returns false otherwise. A false value would be returned, for example, if an action disconnects the client session or notifies the client of login failure.

Specified by:
flush in interface ClientSessionServiceImpl.Action

isCompleted

public boolean isCompleted()
Returns true if relocation preparation is completed.

Returns:
true if relocation preparation is completed

suspend

public void suspend()
Suspends messages to the client before sending the 'relocate' notification. This method is invoked after the session has been prepared for relocation. When message suspension is complete, this instance's completed method is invoked to notify the client to relocate.


completed

public void completed()
Notifies this handler that the operations initiated by the request associated with this future are complete. This method is idempotent and can be called multiple times.

This method is invoked after the session has been prepared for relocation and messages have been suspended from the client (i.e., invoked from the SuspendCompletionHandler.completed method).

Specified by:
completed in interface SimpleCompletionHandler

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved