com.metamatrix.common.comm.platform.socket.client
Class SocketServerConnection

java.lang.Object
  extended by com.metamatrix.common.comm.platform.socket.client.SocketServerConnection
All Implemented Interfaces:
ServerConnection

public class SocketServerConnection
extends java.lang.Object
implements ServerConnection

Represents a client connection that maintains session state and allows for service fail over. Implements a sticky random selection policy.


Constructor Summary
SocketServerConnection(SocketServerInstanceFactory connectionFactory, boolean secure, ServerDiscovery serverDiscovery, java.util.Properties connProps, java.util.Timer pingTimer)
           
 
Method Summary
 void authenticate()
           
 LogonResult getLogonResult()
           
<T> T
getService(java.lang.Class<T> iface)
           
 boolean isOpen()
           
static boolean isSameInstance(java.lang.Object service, java.lang.Object otherService)
           
static void selectNewServerInstance(java.lang.Object service)
           
 SocketServerInstance selectServerInstance()
          Implements a sticky random selection policy TODO: make this customizable TODO: put more information on hostinfo as to process response time, last successful connect, etc.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketServerConnection

public SocketServerConnection(SocketServerInstanceFactory connectionFactory,
                              boolean secure,
                              ServerDiscovery serverDiscovery,
                              java.util.Properties connProps,
                              java.util.Timer pingTimer)
                       throws CommunicationException,
                              ConnectionException
Throws:
CommunicationException
ConnectionException
Method Detail

selectServerInstance

public SocketServerInstance selectServerInstance()
                                          throws CommunicationException
Implements a sticky random selection policy TODO: make this customizable TODO: put more information on hostinfo as to process response time, last successful connect, etc.

Throws:
CommunicationException

authenticate

public void authenticate()
                  throws ConnectionException,
                         CommunicationException
Throws:
ConnectionException
CommunicationException

getService

public <T> T getService(java.lang.Class<T> iface)
Specified by:
getService in interface ServerConnection

shutdown

public void shutdown()
Specified by:
shutdown in interface ServerConnection

isOpen

public boolean isOpen()
Specified by:
isOpen in interface ServerConnection

getLogonResult

public LogonResult getLogonResult()
Specified by:
getLogonResult in interface ServerConnection

isSameInstance

public static boolean isSameInstance(java.lang.Object service,
                                     java.lang.Object otherService)
                              throws CommunicationException
Throws:
CommunicationException

selectNewServerInstance

public static void selectNewServerInstance(java.lang.Object service)


Copyright © 2009. All Rights Reserved.