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.ProgressReporter
progressReporter
protected boolean
shutdown
-
Constructor Summary
Constructors Constructor Description MigrationContextImpl(MigrationServiceImpl.ProgressReporter progressReporter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isShutdownRequested()
Checks if shutdown has been requested.void
reportError(String message, int code)
Notifies the migration context of an error.void
reportProgress(String message, long num, long total)
Notifies the migration context of the current progress.void
requestShutdown()
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.MigrationContext
Notifies the migration context of the current progress.- Specified by:
reportProgress
in 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-1
if unknown
-
reportError
public void reportError(String message, int code)
Description copied from interface:MigrationService.MigrationContext
Notifies the migration context of an error.- Specified by:
reportError
in interfaceMigrationService.MigrationContext
- Parameters:
message
- an informative message about what went wrongcode
- the error code
-
requestShutdown
public void requestShutdown()
Description copied from interface:MigrationService.MigrationContext
Requests a shutdown. Called internally by the migration service when the server shuts down.- Specified by:
requestShutdown
in interfaceMigrationService.MigrationContext
-
isShutdownRequested
public boolean isShutdownRequested()
Description copied from interface:MigrationService.MigrationContext
Checks if shutdown has been requested.This should be checked periodically by the migrator, and when
true
the 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:
isShutdownRequested
in interfaceMigrationService.MigrationContext
- Returns:
true
if migration should be stopped as soon as possible
-
-