Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jbossmx.cluster.watchdog
Class SwapMachines  view SwapMachines download SwapMachines.java

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.activation.Activatable
              extended byorg.jbossmx.cluster.watchdog.SwapMachines
All Implemented Interfaces:
java.rmi.Remote, java.io.Serializable, SwapMachinesRemoteInterface

public class SwapMachines
extends java.rmi.activation.Activatable
implements SwapMachinesRemoteInterface

Class for swapping the roles of active and failover machines, swaps the locations of all the agents.


Field Summary
 
Fields inherited from class java.rmi.activation.Activatable
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
SwapMachines(java.rmi.activation.ActivationID id, java.rmi.MarshalledObject data)
           
 
Method Summary
private  void execScript(java.lang.String script)
          Execute a script
private  boolean isMachineRunning(java.lang.String machineName)
          Gets whether a machine is running
static void main(java.lang.String[] args)
           
 void moveAgent(java.lang.String agentRmi, java.lang.String fromMachine, java.lang.String toMachine)
          Moves a JMX Agent from one machine to another.
private  void moveAgentImpl(java.lang.String rmiAgentBinding, java.lang.String fromMachine, java.lang.String toMachine)
          Moves a JMX Agent from one machine to another.
 void moveAgents(java.util.Set agentRmiBindings, java.lang.String fromMachine, java.lang.String toMachine)
          Moves a set of Agents from one machine to another.
private  void moveAgentsImpl(java.util.Set rmiBindings, java.lang.String fromMachine, java.lang.String toMachine)
          Moves a set of Agents from one machine to another.
private  void moveOdin(java.lang.String machineName)
          Execute a script to change the machine that 'odin' points to
private  void rebootMachine(java.lang.String machineName)
          Execute a script to reboot a machine
private static void Sleep(int millis)
          Sleep for a while
 void swapMachines(java.lang.String rebootingMachine, java.lang.String safeMachine, boolean reboot, boolean putAgentsBackWhereTheyCameFrom, boolean switchOdin)
          Swaps the active and failover machines.
private  void swapMachinesImpl(java.lang.String rebootingMachine, java.lang.String safeMachine, boolean reboot, boolean putAgentsBackWhereTheyCameFrom, boolean switchOdin)
          Swaps the active and failover machines.
 
Methods inherited from class java.rmi.activation.Activatable
exportObject, exportObject, exportObject, exportObject, getID, inactive, register, unexportObject, unregister
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SwapMachines

public SwapMachines(java.rmi.activation.ActivationID id,
                    java.rmi.MarshalledObject data)
             throws java.rmi.RemoteException
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception

swapMachines

public void swapMachines(java.lang.String rebootingMachine,
                         java.lang.String safeMachine,
                         boolean reboot,
                         boolean putAgentsBackWhereTheyCameFrom,
                         boolean switchOdin)
                  throws java.rmi.RemoteException
Swaps the active and failover machines. Spawns the implementation in another thread.

Specified by:
swapMachines in interface SwapMachinesRemoteInterface

moveAgents

public void moveAgents(java.util.Set agentRmiBindings,
                       java.lang.String fromMachine,
                       java.lang.String toMachine)
                throws java.rmi.RemoteException
Moves a set of Agents from one machine to another. Spawns the implementation in another thread.

Specified by:
moveAgents in interface SwapMachinesRemoteInterface

moveAgent

public void moveAgent(java.lang.String agentRmi,
                      java.lang.String fromMachine,
                      java.lang.String toMachine)
               throws java.rmi.RemoteException
Moves a JMX Agent from one machine to another. Spawns the implementation in another thread.

Specified by:
moveAgent in interface SwapMachinesRemoteInterface

swapMachinesImpl

private void swapMachinesImpl(java.lang.String rebootingMachine,
                              java.lang.String safeMachine,
                              boolean reboot,
                              boolean putAgentsBackWhereTheyCameFrom,
                              boolean switchOdin)
Swaps the active and failover machines.


moveAgentsImpl

private void moveAgentsImpl(java.util.Set rmiBindings,
                            java.lang.String fromMachine,
                            java.lang.String toMachine)
Moves a set of Agents from one machine to another.


moveAgentImpl

private void moveAgentImpl(java.lang.String rmiAgentBinding,
                           java.lang.String fromMachine,
                           java.lang.String toMachine)
Moves a JMX Agent from one machine to another.


moveOdin

private void moveOdin(java.lang.String machineName)
Execute a script to change the machine that 'odin' points to


rebootMachine

private void rebootMachine(java.lang.String machineName)
Execute a script to reboot a machine


execScript

private void execScript(java.lang.String script)
Execute a script


isMachineRunning

private boolean isMachineRunning(java.lang.String machineName)
Gets whether a machine is running


Sleep

private static void Sleep(int millis)
Sleep for a while