org.teiid.net.socket
Class SocketServerConnection

java.lang.Object
  extended by org.teiid.net.socket.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.


Field Summary
 
Fields inherited from interface org.teiid.net.ServerConnection
PING_INTERVAL
 
Constructor Summary
SocketServerConnection(SocketServerInstanceFactory connectionFactory, boolean secure, ServerDiscovery serverDiscovery, java.util.Properties connProps)
           
 
Method Summary
 void cleanUp()
           
 void close()
           
 LogonResult getLogonResult()
           
<T> T
getService(java.lang.Class<T> iface)
           
 boolean isOpen(long msToTest)
           
 boolean isSameInstance(ServerConnection otherService)
           
 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 setFailOver(boolean failOver)
           
 void setFailOverPingInterval(int pingFailOverInterval)
           
 
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)
                       throws CommunicationException,
                              ConnectionException
Throws:
CommunicationException
ConnectionException
Method Detail

selectServerInstance

public SocketServerInstance selectServerInstance()
                                          throws CommunicationException,
                                                 ConnectionException
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:
ConnectionException
CommunicationException

getService

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

close

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

isOpen

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

getLogonResult

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

isSameInstance

public boolean isSameInstance(ServerConnection otherService)
                       throws CommunicationException
Specified by:
isSameInstance in interface ServerConnection
Throws:
CommunicationException

cleanUp

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

setFailOver

public void setFailOver(boolean failOver)

setFailOverPingInterval

public void setFailOverPingInterval(int pingFailOverInterval)


Copyright © 2010. All Rights Reserved.