- All Implemented Interfaces:
ConnectionPool,org.eclipse.jetty.util.component.Container,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.Dumpable.DumpableContainer,org.eclipse.jetty.util.component.LifeCycle,org.eclipse.jetty.util.thread.Sweeper.Sweepable
A ConnectionPool that attempts to provide connections using a round-robin algorithm.
The round-robin behavior is almost impossible to achieve for several reasons:
- the server takes different times to serve different requests; if a request takes a long time to be processed by the server, it would be a performance penalty to stall sending requests waiting for that connection to be available - better skip it and try another connection
- connections may be closed by the client or by the server, so it would be a performance penalty to stall sending requests waiting for a new connection to be opened
- thread scheduling on both client and server may temporarily penalize a connection
Do not expect this class to provide connections in a perfect recurring sequence such as
c0, c1, ..., cN-1, c0, c1, ..., cN-1, c0, c1, ... because that is impossible to
achieve in a real environment.
This class will just attempt a best-effort to provide the connections in a sequential order,
but most likely the order will be quasi-random.
Applications using this class should pre-create
the connections to ensure that they are already opened when the application starts to requests
them, otherwise the first connection that is opened may be used multiple times before the others
are opened, resulting in a behavior that is more random-like than more round-robin-like (and
that confirms that round-robin behavior is almost impossible to achieve).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.client.ConnectionPool
ConnectionPool.Factory, ConnectionPool.MaxMultiplexable, ConnectionPool.MaxUsableNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
ConstructorsConstructorDescriptionRoundRobinConnectionPool(Destination destination, int maxConnections) RoundRobinConnectionPool(Destination destination, int maxConnections, int initialMaxMultiplex) -
Method Summary
Methods inherited from class org.eclipse.jetty.client.MultiplexConnectionPool
getInitialMaxMultiplex, newMaxMultiplexer, setInitialMaxMultiplexMethods inherited from class org.eclipse.jetty.client.AbstractConnectionPool
accept, acquire, acquired, activate, deactivate, doStart, doStop, dump, getActiveConnectionCount, getConnectionCount, getIdleConnectionCount, getMaxConnectionCount, getMaxDuration, getMaxUsage, getPendingConnectionCount, idle, isActive, isEmpty, isMaximizeConnections, onCreated, preCreateConnections, proceed, release, released, remove, removed, setMaxDuration, setMaximizeConnections, setMaxUsage, sweep, toString, tryCreateMethods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListenersMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Constructor Details
-
RoundRobinConnectionPool
-
RoundRobinConnectionPool
public RoundRobinConnectionPool(Destination destination, int maxConnections, int initialMaxMultiplex)
-