/**
* Returns the best primary or secondary triad server.
*/
public ClusterServer getActiveServer(ClusterServer oldServer)
{
ClusterServer server;
ClientSocketFactory pool;
server = _primary;
pool = server != null ? server.getClusterSocketPool() : null;
if (pool != null && pool.isActive() && server != oldServer)
return server;
server = _secondary;
pool = server != null ? server.getClusterSocketPool() : null;
if (pool != null && pool.isActive() && server != oldServer)
return server;
server = _tertiary;
pool = server != null ? server.getClusterSocketPool() : null;
if (pool != null && pool.isActive() && server != oldServer)
return server;
// force the send. Server must be active, but pool may have a failure
server = _primary;
if (server != null && server.isHeartbeatActive()) {
pool = server.getClusterSocketPool();
if (pool != null && server != oldServer)
return server;
}
server = _secondary;
if (server != null && server.isHeartbeatActive()) {
pool = server.getClusterSocketPool();
if (pool != null && server != oldServer)
return server;
}
server = _tertiary;
if (server != null && server.isHeartbeatActive()) {
pool = server.getClusterSocketPool();
if (pool != null && server != oldServer)
return server;
}