Package org.teiid.net.socket
Class SocketServerConnection
- java.lang.Object
-
- org.teiid.net.socket.SocketServerConnection
-
- All Implemented Interfaces:
ServerConnection
public class SocketServerConnection extends 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
Constructors Constructor Description SocketServerConnection(SocketServerInstanceFactory connectionFactory, boolean secure, UrlServerDiscovery serverDiscovery, Properties connProps)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
authenticate()
void
close()
LogonResult
getLogonResult()
String
getServerVersion()
<T> T
getService(Class<T> iface)
boolean
isLocal()
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)
boolean
supportsContinuous()
static void
updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver)
-
-
-
Constructor Detail
-
SocketServerConnection
public SocketServerConnection(SocketServerInstanceFactory connectionFactory, boolean secure, UrlServerDiscovery serverDiscovery, Properties connProps) 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.
-
updateConnectionProperties
public static void updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver)
-
getService
public <T> T getService(Class<T> iface)
- Specified by:
getService
in interfaceServerConnection
-
close
public void close()
- Specified by:
close
in interfaceServerConnection
-
isOpen
public boolean isOpen(long msToTest)
- Specified by:
isOpen
in interfaceServerConnection
-
getLogonResult
public LogonResult getLogonResult()
- Specified by:
getLogonResult
in interfaceServerConnection
-
isSameInstance
public boolean isSameInstance(ServerConnection otherService) throws CommunicationException
- Specified by:
isSameInstance
in interfaceServerConnection
- Throws:
CommunicationException
-
setFailOver
public void setFailOver(boolean failOver)
-
setFailOverPingInterval
public void setFailOverPingInterval(int pingFailOverInterval)
-
authenticate
public void authenticate() throws ConnectionException, CommunicationException
- Specified by:
authenticate
in interfaceServerConnection
- Throws:
ConnectionException
CommunicationException
-
supportsContinuous
public boolean supportsContinuous()
- Specified by:
supportsContinuous
in interfaceServerConnection
-
isLocal
public boolean isLocal()
- Specified by:
isLocal
in interfaceServerConnection
-
getServerVersion
public String getServerVersion()
- Specified by:
getServerVersion
in interfaceServerConnection
-
-