Package com.arjuna.ats.arjuna.recovery
Class RecoveryManager
java.lang.Object
com.arjuna.ats.arjuna.recovery.RecoveryManager
The RecoveryManager daemon.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIn this mode the recovery manager does not run periodically and will only work if driven through messages or via the scan operation if it is embedded.static final intIn this mode the recovery manager runs periodically but may also be driven through messages or via the scan operation if it is embedded. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddModule(RecoveryModule module) Add a recovery module to the system.static voidDelay the start of the recovery manager thread when creating an indirect recovery manager.static SocketObtain a client connection to the recovery managerfinal Vector<RecoveryModule> Obtain a snapshot list of available recovery modules.static InetAddressstatic intfinal voidIf the recovery manager has been shutdown previously then recreate it in the same mode as before.static voidRun the RecoveryManager.static final RecoveryManagermanager()Obtain a reference to the RecoveryManager singleton.static final RecoveryManagermanager(int mode) Obtain a reference to the RecoveryManager singleton.final intmode()Indicates what mode (INDIRECT_MANAGEMENT or DIRECT_MANAGEMENT) the recovery manager is configured for.final voidremoveAllModules(boolean waitOnScan) Remove all modules.final voidremoveModule(RecoveryModule module, boolean waitOnScan) Remove a recovery module from the system.voidresume()final voidscan()Force a recovery scan now.final voidscan(RecoveryScan callback) Force a recovery scan now.voidStart the recovery manager thread.voidsuspend(boolean async) Suspend the recovery manager.final voidTerminate and cleanup the recovery manager.final voidterminate(boolean async) Terminate and cleanup the recovery manager.com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerStatustrySuspend(boolean async) voidwait for the recovery thread to be shutdown.
-
Field Details
-
INDIRECT_MANAGEMENT
public static final int INDIRECT_MANAGEMENTIn this mode the recovery manager runs periodically but may also be driven through messages or via the scan operation if it is embedded.- See Also:
-
DIRECT_MANAGEMENT
public static final int DIRECT_MANAGEMENTIn this mode the recovery manager does not run periodically and will only work if driven through messages or via the scan operation if it is embedded.- See Also:
-
-
Method Details
-
manager
Obtain a reference to the RecoveryManager singleton. If it hasn't been created yet then it will be. The manager will be created in the INDIRECT_MANAGEMENT mode.- Returns:
- the manager.
- Throws:
IllegalArgumentException- thrown if the manager has already been created in a different mode to that requested.
-
manager
Obtain a reference to the RecoveryManager singleton. If it hasn't been created yet then it will be. The manager can be created in a management mode defined by the parameter.- Parameters:
mode- the management mode for the manager.- Returns:
- the manager.
- Throws:
IllegalArgumentException- thrown if the manager has already been created in a different mode to that requested.
-
delayRecoveryManagerThread
public static void delayRecoveryManagerThread()Delay the start of the recovery manager thread when creating an indirect recovery manager. -
scan
public final void scan()Force a recovery scan now. This is a blocking operation and will only return once the recovery scan has completed.- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
scan
Force a recovery scan now. This is a non-blocking operation and will return immediately. Notification of completion of the scan is done through the RecoveryScan object.- Parameters:
callback- callback The callback mechanism used to inform users that the scan has completed. If this isnullthen no callback will happen and asynchronous scanning will occur.- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
terminate
public final void terminate()Terminate and cleanup the recovery manager. There is no going back from this. This is a synchronous operation so return means that the recovery has completed.- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
terminate
public final void terminate(boolean async) Terminate and cleanup the recovery manager. There is no going back from this. Can be called synchronous or asynchronously. If you have any intention of restarting the recovery manager later then you MUST use the async=false option.- Parameters:
async- false means wait for any recovery scan in progress to complete.- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
initialize
public final void initialize()If the recovery manager has been shutdown previously then recreate it in the same mode as before. Otherwise ignore. -
waitForTermination
public void waitForTermination()wait for the recovery thread to be shutdown. n.b. this will not return unless and until shutdown is called.- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
suspend
public void suspend(boolean async) Suspend the recovery manager. If the recovery manager is in the process of doing recovery scans then it will be suspended afterwards, in order to preserve data integrity.- Parameters:
async- false means wait for the recovery manager to finish any scans before returning.- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
trySuspend
public com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerStatus trySuspend(boolean async) -
resume
public void resume()- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
startRecoveryManagerThread
public void startRecoveryManagerThread()Start the recovery manager thread.- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
addModule
Add a recovery module to the system.- Parameters:
module- module The module to add.- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
removeModule
Remove a recovery module from the system.- Parameters:
module- The module to remove.waitOnScan- true if the remove operation should wait for any in-progress scan to complete- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
removeAllModules
public final void removeAllModules(boolean waitOnScan) Remove all modules. WARNING: Use with extreme care as this will stop recovery from doing anything! -
getModules
Obtain a snapshot list of available recovery modules.- Returns:
- a snapshot list of the currently installed recovery modules
- Throws:
IllegalStateException- if the recovery manager has been shutdown.
-
mode
public final int mode()Indicates what mode (INDIRECT_MANAGEMENT or DIRECT_MANAGEMENT) the recovery manager is configured for.- Returns:
- the management mode.
-
getRecoveryManagerHost
- Throws:
UnknownHostException
-
getRecoveryManagerPort
public static int getRecoveryManagerPort() -
getClientSocket
Obtain a client connection to the recovery manager- Returns:
- a bound client socket connection to the recovery manager
- Throws:
IOException
-
main
Run the RecoveryManager. See Administration manual for details.
-