D
- either java.sql.Driver or javax.sql.DataSourcepublic class LoadBalancer<Z,D extends Database<Z>> extends AbstractBalancer<Z,D>
next()
implementation returns the database with the least load.Constructor and Description |
---|
LoadBalancer(Set<D> databases)
Constructs a new LoadBalancer
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(D database) |
boolean |
addAll(Collection<? extends D> databases) |
void |
clear() |
protected Set<D> |
getDatabases() |
<T,R,E extends Exception> |
invoke(Invoker<Z,D,T,R,E> invoker,
D database,
T object)
Invoke the specified invoker on the specified object against the specified database, potentially informing the balancer.
|
D |
next()
Returns the next database from this balancer
|
D |
primary()
Returns the primary database.
|
boolean |
remove(Object database) |
boolean |
removeAll(Collection<?> databases) |
boolean |
retainAll(Collection<?> databases) |
public LoadBalancer(Set<D> databases)
databases
- public D primary()
Balancer.primary()
protected Set<D> getDatabases()
getDatabases
in class AbstractBalancer<Z,D extends Database<Z>>
AbstractBalancer.getDatabases()
public boolean addAll(Collection<? extends D> databases)
Set.addAll(java.util.Collection)
public boolean removeAll(Collection<?> databases)
Set.removeAll(java.util.Collection)
public boolean retainAll(Collection<?> databases)
Set.retainAll(java.util.Collection)
public void clear()
Set.clear()
public boolean remove(Object database)
Set.remove(java.lang.Object)
public D next()
Balancer.next()
public boolean add(D database)
Set.add(java.lang.Object)
public <T,R,E extends Exception> R invoke(Invoker<Z,D,T,R,E> invoker, D database, T object) throws E extends Exception
T
- invoker target object typeR
- invoker return typeE
- invoker exception typeE
E extends Exception
Balancer.invoke(net.sf.hajdbc.invocation.Invoker, net.sf.hajdbc.Database, java.lang.Object)
Copyright © 2004–2014 Paul Ferraro. All rights reserved.