com.threerings.presents.client
Class Client.ServerSwitcher

java.lang.Object
  extended by com.threerings.presents.client.ClientAdapter
      extended by com.threerings.presents.client.Client.ServerSwitcher
All Implemented Interfaces:
ClientObserver, SessionObserver
Enclosing class:
Client

protected class Client.ServerSwitcher
extends ClientAdapter

Handles the process of switching between servers. See Client.moveToServer(java.lang.String, int[], com.threerings.presents.client.InvocationService.ConfirmListener).


Field Summary
protected  int[] _datagramPorts
           
protected  String _hostname
           
protected  InvocationService.ConfirmListener _observer
           
protected  int[] _oldDatagramPorts
           
protected  String _oldHostname
           
protected  int[] _oldPorts
           
protected  int[] _ports
           
 
Constructor Summary
Client.ServerSwitcher(String hostname, int[] ports, int[] datagramPorts, InvocationService.ConfirmListener obs)
           
Client.ServerSwitcher(String hostname, int[] ports, InvocationService.ConfirmListener obs)
           
 
Method Summary
 void clientDidClear(Client client)
          Called after the client is completely logged off from a successful session and is ready to reconnect to a new server if desired.
 void clientDidLogon(Client client)
          Called after the client successfully connected to and authenticated with the server.
 void clientFailedToLogon(Client client, Exception cause)
          Called if anything fails during the logon attempt.
 void switchServers()
           
 
Methods inherited from class com.threerings.presents.client.ClientAdapter
clientConnectionFailed, clientDidLogoff, clientObjectDidChange, clientWillLogoff, clientWillLogon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_hostname

protected String _hostname

_oldHostname

protected String _oldHostname

_ports

protected int[] _ports

_oldPorts

protected int[] _oldPorts

_datagramPorts

protected int[] _datagramPorts

_oldDatagramPorts

protected int[] _oldDatagramPorts

_observer

protected InvocationService.ConfirmListener _observer
Constructor Detail

Client.ServerSwitcher

public Client.ServerSwitcher(String hostname,
                             int[] ports,
                             InvocationService.ConfirmListener obs)

Client.ServerSwitcher

public Client.ServerSwitcher(String hostname,
                             int[] ports,
                             int[] datagramPorts,
                             InvocationService.ConfirmListener obs)
Method Detail

switchServers

public void switchServers()

clientDidClear

public void clientDidClear(Client client)
Description copied from interface: ClientObserver
Called after the client is completely logged off from a successful session and is ready to reconnect to a new server if desired. This will only be called after an active session was terminated, not after a logon attempt failed as that failure will be reported by ClientObserver.clientFailedToLogon(com.threerings.presents.client.Client, java.lang.Exception).

Specified by:
clientDidClear in interface ClientObserver
Overrides:
clientDidClear in class ClientAdapter

clientDidLogon

public void clientDidLogon(Client client)
Description copied from interface: SessionObserver
Called after the client successfully connected to and authenticated with the server. The entire object system is up and running by the time this method is called.

Specified by:
clientDidLogon in interface SessionObserver
Overrides:
clientDidLogon in class ClientAdapter

clientFailedToLogon

public void clientFailedToLogon(Client client,
                                Exception cause)
Description copied from interface: ClientObserver
Called if anything fails during the logon attempt. This could be a network failure, authentication failure or otherwise. The exception provided will indicate the cause of the failure.

Specified by:
clientFailedToLogon in interface ClientObserver
Overrides:
clientFailedToLogon in class ClientAdapter
cause - an exception indicating the cause of the logon failure. Note: this may be a LogonException and if so, the caller must check LogonException.isStillInProgress() to find out if the logon process has totally failed or if we are simply reporting intermediate status (we might be falling back to an alternative port or delaying our auto-retry attempt due to server overload).