* Returns the best primary or secondary triad server.
*/
public ClusterServer getActiveServer(Owner owner,
ClusterServer oldServer)
{
ClusterServer server;
ClientSocketFactory pool;
server = getPrimary(owner);
if (server != null && server.isHeartbeatActive()) {
pool = server.getClusterSocketPool();
if (pool != null && pool.isActive() && server != oldServer)
return server;
}
server = getSecondary(owner);
if (server != null && server.isHeartbeatActive()) {
pool = server.getClusterSocketPool();
if (pool != null && pool.isActive() && server != oldServer)
return server;
}
server = getTertiary(owner);
if (server != null && server.isHeartbeatActive()) {
pool = server.getClusterSocketPool();
if (pool != null && pool.isActive() && server != oldServer)
return server;
}
// force the send
server = getPrimary(owner);
pool = server != null ? server.getClusterSocketPool() : null;
if (pool != null && server != oldServer)
return server;
server = getSecondary(owner);
pool = server != null ? server.getClusterSocketPool() : null;
if (pool != null && server != oldServer)
return server;
server = getTertiary(owner);
pool = server != null ? server.getClusterSocketPool() : null;
if (pool != null && server != oldServer)
return server;
return null;