org.teiid.net.socket
Class UrlServerDiscovery

java.lang.Object
  extended by org.teiid.net.socket.UrlServerDiscovery
All Implemented Interfaces:
ServerDiscovery

public class UrlServerDiscovery
extends java.lang.Object
implements ServerDiscovery

Simple URL discovery strategy with a random load balancing policy TOOD: add black listing support


Constructor Summary
UrlServerDiscovery()
           
UrlServerDiscovery(TeiidURL url)
           
 
Method Summary
 void connectionSuccessful(HostInfo info)
          Indicates that a connection was made successfully to the given host.
 java.util.List<HostInfo> getKnownHosts(LogonResult result, SocketServerInstance instance)
          Get the currently known hosts.
 void init(TeiidURL url, java.util.Properties p)
          Initialize the ServerDiscovery
 void markInstanceAsBad(HostInfo info)
          Indicates that a connection could not be made to the given host.
 HostInfo selectNextInstance(java.util.List<HostInfo> hosts)
          Select the next instance to try.
 void shutdown()
          Shutdown this ServerDiscovery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlServerDiscovery

public UrlServerDiscovery()

UrlServerDiscovery

public UrlServerDiscovery(TeiidURL url)
Method Detail

getKnownHosts

public java.util.List<HostInfo> getKnownHosts(LogonResult result,
                                              SocketServerInstance instance)
Description copied from interface: ServerDiscovery
Get the currently known hosts. Will be called prior to connecting and after authentication for each connection.

Specified by:
getKnownHosts in interface ServerDiscovery
Returns:

init

public void init(TeiidURL url,
                 java.util.Properties p)
Description copied from interface: ServerDiscovery
Initialize the ServerDiscovery

Specified by:
init in interface ServerDiscovery

connectionSuccessful

public void connectionSuccessful(HostInfo info)
Description copied from interface: ServerDiscovery
Indicates that a connection was made successfully to the given host.

Specified by:
connectionSuccessful in interface ServerDiscovery

markInstanceAsBad

public void markInstanceAsBad(HostInfo info)
Description copied from interface: ServerDiscovery
Indicates that a connection could not be made to the given host.

Specified by:
markInstanceAsBad in interface ServerDiscovery

shutdown

public void shutdown()
Description copied from interface: ServerDiscovery
Shutdown this ServerDiscovery

Specified by:
shutdown in interface ServerDiscovery

selectNextInstance

public HostInfo selectNextInstance(java.util.List<HostInfo> hosts)
Description copied from interface: ServerDiscovery
Select the next instance to try. The entry should be removed from the list when no more attempts are desired. and not return null.

Specified by:
selectNextInstance in interface ServerDiscovery
Returns:
a non-null HostInfo to try


Copyright © 2011. All Rights Reserved.