Package org.nuxeo.runtime.migration
Class MigrationServiceImpl.MigrationContextImpl
- java.lang.Object
-
- org.nuxeo.runtime.migration.MigrationServiceImpl.MigrationContextImpl
-
- All Implemented Interfaces:
MigrationService.MigrationContext
- Enclosing class:
- MigrationServiceImpl
protected static class MigrationServiceImpl.MigrationContextImpl extends Object implements MigrationService.MigrationContext
Migration context implementation that reports progress in the key/value store and can be shutdown.- Since:
- 9.3
-
-
Field Summary
Fields Modifier and Type Field Description protected MigrationServiceImpl.ProgressReporterprogressReporterprotected booleanshutdown
-
Constructor Summary
Constructors Constructor Description MigrationContextImpl(MigrationServiceImpl.ProgressReporter progressReporter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisShutdownRequested()Checks if shutdown has been requested.voidreportError(String message, int code)Notifies the migration context of an error.voidreportProgress(String message, long num, long total)Notifies the migration context of the current progress.voidrequestShutdown()Requests a shutdown.
-
-
-
Field Detail
-
progressReporter
protected final MigrationServiceImpl.ProgressReporter progressReporter
-
shutdown
protected volatile boolean shutdown
-
-
Constructor Detail
-
MigrationContextImpl
public MigrationContextImpl(MigrationServiceImpl.ProgressReporter progressReporter)
-
-
Method Detail
-
reportProgress
public void reportProgress(String message, long num, long total)
Description copied from interface:MigrationService.MigrationContextNotifies the migration context of the current progress.- Specified by:
reportProgressin interfaceMigrationService.MigrationContext- Parameters:
message- an informative message about what is being migratednum- the current number of things migratedtotal- the total number of things to migrate, or-1if unknown
-
reportError
public void reportError(String message, int code)
Description copied from interface:MigrationService.MigrationContextNotifies the migration context of an error.- Specified by:
reportErrorin interfaceMigrationService.MigrationContext- Parameters:
message- an informative message about what went wrongcode- the error code
-
requestShutdown
public void requestShutdown()
Description copied from interface:MigrationService.MigrationContextRequests a shutdown. Called internally by the migration service when the server shuts down.- Specified by:
requestShutdownin interfaceMigrationService.MigrationContext
-
isShutdownRequested
public boolean isShutdownRequested()
Description copied from interface:MigrationService.MigrationContextChecks if shutdown has been requested.This should be checked periodically by the migrator, and when
truethe migrator should return as soon as possible, even if its work is not complete.This is a "nice" version of thread interruption, which will follow a short while later, and should also be checked by the migrator.
- Specified by:
isShutdownRequestedin interfaceMigrationService.MigrationContext- Returns:
trueif migration should be stopped as soon as possible
-
-