public class RoundRobinConnectionStrategy extends Object implements ConnectionStrategy
useConnectionCount
to false if using this strategy with a connection pool.Modifier and Type | Field and Description |
---|---|
private int |
invocationCount
Internal method invocation counter.
|
private boolean |
useConnectionCount
Whether
getLdapUrls(ConnectionFactoryMetadata) should use the connectionCount parameter or the invocationCount . |
Constructor and Description |
---|
RoundRobinConnectionStrategy()
Creates a new round robin connection strategy.
|
RoundRobinConnectionStrategy(boolean b)
Creates a new round robin connection strategy.
|
Modifier and Type | Method and Description |
---|---|
protected int |
getCount(int connectionCount)
Returns the supplied connection count if
useConnectionCount is true. |
String[] |
getLdapUrls(ConnectionFactoryMetadata metadata)
Return a list of URLs that cycles the list order.
|
private int |
returnAndIncrementInvocationCount()
Increments the internal invocation count and returns the previous value.
|
private int invocationCount
private final boolean useConnectionCount
getLdapUrls(ConnectionFactoryMetadata)
should use the connectionCount parameter or the invocationCount
.public RoundRobinConnectionStrategy()
public RoundRobinConnectionStrategy(boolean b)
b
- whether getLdapUrls(ConnectionFactoryMetadata)
should use the connectionCount parameterpublic String[] getLdapUrls(ConnectionFactoryMetadata metadata)
getLdapUrls
in interface ConnectionStrategy
metadata
- which can be used to produce the URL listprotected int getCount(int connectionCount)
useConnectionCount
is true. Otherwise returns invocationCount
.connectionCount
- as reported by the connectionprivate int returnAndIncrementInvocationCount()
Copyright © 2003-2019 Virginia Tech. All Rights Reserved.