org.rhq.enterprise.server.cloud
Class FailoverListManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.cloud.FailoverListManagerBean
All Implemented Interfaces:
FailoverListManagerLocal

public class FailoverListManagerBean
extends Object
implements FailoverListManagerLocal

This session beans acts as the single interface with which the distribution algorithm will interact. The distribution algorithm runs as a result of various changes in the system including but not limited to: newly registering agents, currently connecting agents, cloud membership changes (server added/removed), and redistributions according to agent load. The result of the distribution algorithm is a single (or a set of) FailoverList objects that are sent down to the connected agents. The agents then use these lists to determine which server to fail over to, if their primary server is unreachable and/or goes down.

Author:
Joseph Marques, Jay Shaughnessy

Constructor Summary
FailoverListManagerBean()
           
 
Method Summary
 void deleteServerListDetailsForServer(int serverId)
          For a server being deleted it is necessary to remove server lists details referencing the server.
 void deleteServerListsForAgent(org.rhq.core.domain.resource.Agent agent)
          For an agent being deleted it is necessary to remove server lists for the agent.
 org.rhq.core.domain.cloud.composite.FailoverListComposite getExistingForSingleAgent(String agentName)
          Returns the existing server list for the specified agent, if it exists.
 org.rhq.core.domain.cloud.composite.FailoverListComposite getForSingleAgent(org.rhq.core.domain.cloud.PartitionEvent event, String agentName)
          Note that load is balanced as best as possible without a full refresh.
 Map<org.rhq.core.domain.resource.Agent,org.rhq.core.domain.cloud.composite.FailoverListComposite> refresh(org.rhq.core.domain.cloud.PartitionEvent event)
          Performs a full repartition, re-balancing the agent load on available servers and generating new server lists for every agent.
 Map<org.rhq.core.domain.resource.Agent,org.rhq.core.domain.cloud.composite.FailoverListComposite> refresh(org.rhq.core.domain.cloud.PartitionEvent event, List<org.rhq.core.domain.cloud.Server> servers, List<org.rhq.core.domain.resource.Agent> agents)
          Primarily a testing entry point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FailoverListManagerBean

public FailoverListManagerBean()
Method Detail

getExistingForSingleAgent

public org.rhq.core.domain.cloud.composite.FailoverListComposite getExistingForSingleAgent(String agentName)
Description copied from interface: FailoverListManagerLocal
Returns the existing server list for the specified agent, if it exists.

Specified by:
getExistingForSingleAgent in interface FailoverListManagerLocal
Returns:
the existing server list. Null if for any reason the list is not found.

getForSingleAgent

public org.rhq.core.domain.cloud.composite.FailoverListComposite getForSingleAgent(org.rhq.core.domain.cloud.PartitionEvent event,
                                                                                   String agentName)
Description copied from interface: FailoverListManagerLocal
Note that load is balanced as best as possible without a full refresh.

Specified by:
getForSingleAgent in interface FailoverListManagerLocal
Parameters:
event - the partition event prompting this get/create.
Returns:
the existing server list for the specified agent, if it exists, otherwise a newly generated server list is returned.

refresh

public Map<org.rhq.core.domain.resource.Agent,org.rhq.core.domain.cloud.composite.FailoverListComposite> refresh(org.rhq.core.domain.cloud.PartitionEvent event)
Description copied from interface: FailoverListManagerLocal

Performs a full repartition, re-balancing the agent load on available servers and generating new server lists for every agent. Previous server lists are deleted from the database and the new server lists are persisted.

Currently assigns to all known agents. This seems right even though some "down" agents may be dead and never come back online. That is really a separate design decision and is subject to change.

Specified by:
refresh in interface FailoverListManagerLocal
Returns:

refresh

public Map<org.rhq.core.domain.resource.Agent,org.rhq.core.domain.cloud.composite.FailoverListComposite> refresh(org.rhq.core.domain.cloud.PartitionEvent event,
                                                                                                                 List<org.rhq.core.domain.cloud.Server> servers,
                                                                                                                 List<org.rhq.core.domain.resource.Agent> agents)
Description copied from interface: FailoverListManagerLocal
Primarily a testing entry point. In general use refresh().

Specified by:
refresh in interface FailoverListManagerLocal
Returns:

deleteServerListsForAgent

public void deleteServerListsForAgent(org.rhq.core.domain.resource.Agent agent)
Description copied from interface: FailoverListManagerLocal
For an agent being deleted it is necessary to remove server lists for the agent.

This is primarily a test entry point as of 1.1.0 since we currently never delete agents from the database.

Specified by:
deleteServerListsForAgent in interface FailoverListManagerLocal

deleteServerListDetailsForServer

public void deleteServerListDetailsForServer(int serverId)
Description copied from interface: FailoverListManagerLocal
For a server being deleted it is necessary to remove server lists details referencing the server. This may create a gap in the server list ordinal values but that shouldn't matter, ordering is still preserved and we never access a specific server by ordinal.

Specified by:
deleteServerListDetailsForServer in interface FailoverListManagerLocal


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.