D
- either java.sql.Driver or javax.sql.DataSourcepublic class RandomBalancer<P,D extends Database<P>> extends AbstractSetBalancer<P,D>
next()
implementation returns a random database.
The probability that a given database will be returned is: weight / total-weight.Constructor and Description |
---|
RandomBalancer(Set<D> databases)
Constructs a new RandomBalancer
|
Modifier and Type | Method and Description |
---|---|
protected void |
added(D database)
Called when a database was added to the set.
|
protected void |
cleared()
Called when the set was cleared.
|
D |
next()
Returns the next database from this balancer
|
protected void |
removed(D database)
Called when a database was removed from the set.
|
add, addAll, clear, getDatabases, getLock, invoke, primary, remove, removeAll, retainAll
public RandomBalancer(Set<D> databases)
databases
- public D next()
Balancer.next()
protected void added(D database)
added
in class AbstractSetBalancer<P,D extends Database<P>>
database
- a database descriptorAbstractSetBalancer.added(net.sf.hajdbc.Database)
protected void removed(D database)
removed
in class AbstractSetBalancer<P,D extends Database<P>>
database
- a database descriptorAbstractSetBalancer.removed(net.sf.hajdbc.Database)
protected void cleared()
cleared
in class AbstractSetBalancer<P,D extends Database<P>>
AbstractSetBalancer.cleared()
Copyright © 2004–2014 Paul Ferraro. All rights reserved.