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
ConstructorsConstructorDescriptionJRTConnectionPool(ConfigSourceSet sourceSet) JRTConnectionPool(ConfigSourceSet sourceSet, com.yahoo.jrt.Supervisor supervisor) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the current JRTConnection instanceintgetSize()final List<JRTConnection>protected final JRTConnectionpickNewConnectionRandomly(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
-
getCurrent
Returns the current JRTConnection instance- Specified by:
getCurrentin interfaceConnectionPool- Returns:
- a JRTConnection
-
switchConnection
Description copied from interface:ConnectionPoolSwitches to another (healthy, if possible) Connection instance.ConnectionPool.getCurrent()will return this instance afterwards, which is also the return value.- Specified by:
switchConnectionin interfaceConnectionPool- Returns:
- a Connection
-
pickNewConnectionRandomly
-
getSources
-
updateSources
-
updateSources
-
toString
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnectionPool
-
getSize
public int getSize()- Specified by:
getSizein interfaceConnectionPool
-
connections
- Specified by:
connectionsin interfaceConnectionPool
-