Package com.yahoo.vespa.config
Class JRTConnectionPool
- java.lang.Object
-
- com.yahoo.vespa.config.JRTConnectionPool
-
- All Implemented Interfaces:
ConnectionPool
public class JRTConnectionPool extends java.lang.Object implements ConnectionPool
A pool of JRT connections to a config source (either a config server or a config proxy). The current connection is chosen randomly when calling {#link #setNewCurrentConnection} (since the connection is chosen randomly, it might end up using the same connection again, and it will always do so if there is only one source). The current connection is available withgetCurrent()
. When callingsetError(Connection, int)
, {#link #setNewCurrentConnection} will always be called.- Author:
- Gunnar Gauslaa Bergem, hmusum
-
-
Constructor Summary
Constructors Constructor Description JRTConnectionPool(ConfigSourceSet sourceSet)
JRTConnectionPool(java.util.List<java.lang.String> addresses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSources(ConfigSourceSet sourceSet)
void
close()
JRTConnection
getCurrent()
Returns the current JRTConnection instanceint
getSize()
com.yahoo.jrt.Supervisor
getSupervisor()
void
setError(Connection connection, int errorCode)
JRTConnection
setNewCurrentConnection()
Returns and set the current JRTConnection instance by randomly choosing from the available sources (this means that you might end up using the same connection).java.lang.String
toString()
JRTConnectionPool
updateSources(ConfigSourceSet sourceSet)
JRTConnectionPool
updateSources(java.util.List<java.lang.String> addresses)
-
-
-
Constructor Detail
-
JRTConnectionPool
public JRTConnectionPool(ConfigSourceSet sourceSet)
-
JRTConnectionPool
public JRTConnectionPool(java.util.List<java.lang.String> addresses)
-
-
Method Detail
-
addSources
public void addSources(ConfigSourceSet sourceSet)
-
getCurrent
public JRTConnection getCurrent()
Returns the current JRTConnection instance- Specified by:
getCurrent
in interfaceConnectionPool
- Returns:
- a JRTConnection
-
setNewCurrentConnection
public JRTConnection setNewCurrentConnection()
Returns and set the current JRTConnection instance by randomly choosing from the available sources (this means that you might end up using the same connection).- Specified by:
setNewCurrentConnection
in interfaceConnectionPool
- Returns:
- a JRTConnection
-
setError
public void setError(Connection connection, int errorCode)
- Specified by:
setError
in interfaceConnectionPool
-
updateSources
public JRTConnectionPool updateSources(java.util.List<java.lang.String> addresses)
-
updateSources
public JRTConnectionPool updateSources(ConfigSourceSet sourceSet)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
close
public void close()
- Specified by:
close
in interfaceConnectionPool
-
getSize
public int getSize()
- Specified by:
getSize
in interfaceConnectionPool
-
getSupervisor
public com.yahoo.jrt.Supervisor getSupervisor()
- Specified by:
getSupervisor
in interfaceConnectionPool
-
-