public class RandomHostSelector extends java.lang.Object implements HostSelector
| Constructor and Description |
|---|
RandomHostSelector() |
| Modifier and Type | Method and Description |
|---|---|
HostSpec |
getHost(java.util.List<HostSpec> hosts,
HostRole role)
Selects a host with the requested role from the given host list.
|
public HostSpec getHost(java.util.List<HostSpec> hosts, HostRole role) throws java.sql.SQLException
HostSelectorgetHost in interface HostSelectorhosts - a list of available hosts to pick fromrole - the desired host role - either a writer or a readerjava.sql.SQLException - if the host list does not contain any hosts matching the requested role or
an error occurs while selecting a host