- java.lang.Object
-
- javax.crac.Core
-
public class Core extends Object
The coordination service.
-
-
Field Summary
Fields Modifier and Type Field Description static intCOPY_WHEN_RESTOREcopy the file from image dir to origin file path when restorestatic intOVERRIDE_WHEN_RESTOREIf the file exist when restore, override the filesstatic intSAVE_ONLYsave the pseudo persistent file to image dir, but not restore.static intSAVE_RESTOREsave the pseudo persistent file to image dir, then restore to origin pathstatic intSYMLINK_WHEN_RESTOREcreate a symbol link when restore a file.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidappendToAppClassLoaderClassPath(String path)append path to app clasloader's classpath.static voidcheckpointRestore()Requests checkpoint and returns upon a successful restore.static Context<Resource>getGlobalContext()Gets the globalContextfor checkpoint/restore notifications.static voidregisterPseudoPersistent(String absoluteFilePath, int mode)Pseudo persistent is the file that persistent when checkpoint.static voidunregisterPseudoPersistent(String absoluteFilePath)Unregister the file that register in registerPseudoPersistent
-
-
-
Field Detail
-
SAVE_RESTORE
public static final int SAVE_RESTORE
save the pseudo persistent file to image dir, then restore to origin path- See Also:
- Constant Field Values
-
SAVE_ONLY
public static final int SAVE_ONLY
save the pseudo persistent file to image dir, but not restore.- See Also:
- Constant Field Values
-
OVERRIDE_WHEN_RESTORE
public static final int OVERRIDE_WHEN_RESTORE
If the file exist when restore, override the files- See Also:
- Constant Field Values
-
COPY_WHEN_RESTORE
public static final int COPY_WHEN_RESTORE
copy the file from image dir to origin file path when restore- See Also:
- Constant Field Values
-
SYMLINK_WHEN_RESTORE
public static final int SYMLINK_WHEN_RESTORE
create a symbol link when restore a file. This should a better performance than COPY_WHEN_RESTORE if file is large- See Also:
- Constant Field Values
-
-
Method Detail
-
getGlobalContext
public static Context<Resource> getGlobalContext()
Gets the globalContextfor checkpoint/restore notifications.- Returns:
- the global
Context
-
checkpointRestore
public static void checkpointRestore() throws CheckpointException, RestoreExceptionRequests checkpoint and returns upon a successful restore. May throw an exception if the checkpoint or restore are unsuccessful.- Throws:
CheckpointException- if an exception occured during checkpoint notification and the execution continues in the original Java instance.RestoreException- if an exception occured during restore notification and execution continues in a new Java instance.UnsupportedOperationException- if checkpoint/restore is not supported, no notification performed and the execution continues in the original Java instance.
-
registerPseudoPersistent
public static void registerPseudoPersistent(String absoluteFilePath, int mode)
Pseudo persistent is the file that persistent when checkpoint. This file can be modified after restore, but the change is discard when restore again. Register the file path to JVM so that JVM can ignore the file check when checkpoint- Parameters:
absoluteFilePath- the file path that need to registermode- control the action when checkpoint and restore pseudo persistent file. See the constants define in current class.
-
unregisterPseudoPersistent
public static void unregisterPseudoPersistent(String absoluteFilePath)
Unregister the file that register in registerPseudoPersistent- Parameters:
absoluteFilePath- the file path that need to unregister
-
appendToAppClassLoaderClassPath
public static void appendToAppClassLoaderClassPath(String path) throws CheckpointException
append path to app clasloader's classpath.- Parameters:
path- the file need to append- Throws:
CheckpointException- this method can be called only when restore in progress
-
-