Package com.yahoo.vespa.config
Class JRTConnectionPool
java.lang.Object
com.yahoo.vespa.config.JRTConnectionPool
- All Implemented Interfaces:
ConnectionPool
,AutoCloseable
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
switchConnection(Connection)
(it will continue to use the same connection if there is only one source).
The current connection is available with getCurrent()
.- Author:
- Gunnar Gauslaa Bergem, hmusum
-
Constructor Summary
ConstructorDescriptionJRTConnectionPool
(ConfigSourceSet sourceSet) JRTConnectionPool
(ConfigSourceSet sourceSet, com.yahoo.jrt.Supervisor supervisor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSources
(ConfigSourceSet sourceSet) void
close()
Returns the current JRTConnection instanceint
getSize()
protected List<JRTConnection>
protected JRTConnection
pickNewConnectionRandomly
(List<JRTConnection> sources) switchConnection
(Connection failingConnection) Switches to another (healthy, if possible) Connection instance.toString()
updateSources
(ConfigSourceSet sourceSet) updateSources
(List<String> addresses)
-
Constructor Details
-
JRTConnectionPool
-
JRTConnectionPool
-
-
Method Details
-
addSources
-
getCurrent
Returns the current JRTConnection instance- Specified by:
getCurrent
in interfaceConnectionPool
- Returns:
- a JRTConnection
-
switchConnection
Description copied from interface:ConnectionPool
Switches to another (healthy, if possible) Connection instance.ConnectionPool.getCurrent()
will return this instance afterwards, which is also the return value.- Specified by:
switchConnection
in interfaceConnectionPool
- Returns:
- a Connection
-
initialize
-
pickNewConnectionRandomly
-
getSources
-
updateSources
-
updateSources
-
toString
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnectionPool
-
getSize
public int getSize()- Specified by:
getSize
in interfaceConnectionPool
-