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
FieldsModifier and TypeFieldDescriptionprotected final MigrationServiceImpl.ProgressReporterprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionMigrationContextImpl(MigrationServiceImpl.ProgressReporter progressReporter) -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks 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.voidRequests a shutdown.
-
Field Details
-
progressReporter
-
shutdown
protected volatile boolean shutdown
-
-
Constructor Details
-
MigrationContextImpl
-
-
Method Details
-
reportProgress
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
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
-