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
Modifier and TypeFieldDescriptionprotected final MigrationServiceImpl.ProgressReporter
protected boolean
-
Constructor Summary
ConstructorDescriptionMigrationContextImpl
(MigrationServiceImpl.ProgressReporter progressReporter) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
Requests a shutdown.
-
Field Details
-
progressReporter
-
shutdown
protected volatile boolean shutdown
-
-
Constructor Details
-
MigrationContextImpl
-
-
Method Details
-
reportProgress
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
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
-