public class MigrationServiceImpl extends DefaultComponent implements MigrationService
Data about migration status is stored in the "migration" Key/Value Store in the following format:
mymigration:lock write lock, containing debug info about locker; set with a TTL mymigration the state of the migration, if not running mymigration:step the step of the migration, if running mymigration:starttime the migration step start time (milliseconds since epoch) mymigration:pingtime the migration step last ping time (milliseconds since epoch) mymigration:message the migration step current message mymigration:num the migration step current num mymigration:total the migration step current total
Modifier and Type | Class and Description |
---|---|
protected static class |
MigrationServiceImpl.MigrationContextImpl
Migration context implementation that reports progress in the key/value store and can be shutdown.
|
static class |
MigrationServiceImpl.MigrationInvalidation |
class |
MigrationServiceImpl.MigrationInvalidator |
static class |
MigrationServiceImpl.MigrationRegistry |
protected static class |
MigrationServiceImpl.MigrationThreadPoolExecutor
Thread pool executor that records
Runnable s to be able to request shutdown on them. |
protected static class |
MigrationServiceImpl.MigratorWithContext
Runnable for the migrator, that knows about the migration context.
|
protected static class |
MigrationServiceImpl.ProgressReporter
Progress reporter that reports progress in the key/value store.
|
MigrationService.MigrationContext, MigrationService.MigrationStatus, MigrationService.Migrator, MigrationService.StatusChangeNotifier
Modifier and Type | Field and Description |
---|---|
static String |
CLUSTERING_ENABLED_PROP |
static String |
CONFIG_XP |
protected MigrationServiceImpl.MigrationThreadPoolExecutor |
executor |
protected MigrationServiceImpl.MigrationInvalidator |
invalidator |
static String |
KEYVALUE_STORE_NAME |
static String |
LOCK |
static String |
MIGRATION_INVAL_PUBSUB_TOPIC |
static String |
NODE_ID_PROP |
static String |
PING_TIME |
static String |
PROGRESS_MESSAGE |
static String |
PROGRESS_NUM |
static String |
PROGRESS_TOTAL |
protected static Random |
RANDOM |
protected MigrationServiceImpl.MigrationRegistry |
registry |
static String |
START_TIME |
static String |
STEP |
static long |
WRITE_LOCK_TTL |
lastModified
Constructor and Description |
---|
MigrationServiceImpl() |
activate, deactivate, getAdapter, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtension
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applicationStarted
public static final String KEYVALUE_STORE_NAME
public static final String CONFIG_XP
public static final String LOCK
public static final String STEP
public static final String START_TIME
public static final String PING_TIME
public static final String PROGRESS_MESSAGE
public static final String PROGRESS_NUM
public static final String PROGRESS_TOTAL
public static final long WRITE_LOCK_TTL
public static final String MIGRATION_INVAL_PUBSUB_TOPIC
public static final String CLUSTERING_ENABLED_PROP
public static final String NODE_ID_PROP
protected final MigrationServiceImpl.MigrationRegistry registry
protected MigrationServiceImpl.MigrationThreadPoolExecutor executor
protected MigrationServiceImpl.MigrationInvalidator invalidator
public MigrationServiceImpl()
protected static KeyValueStore getKeyValueStore()
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public void registerMigrationDescriptor(MigrationDescriptor descriptor)
public void unregisterMigrationDescriptor(MigrationDescriptor descriptor)
public Map<String,MigrationDescriptor> getMigrationDescriptors()
public int getApplicationStartedOrder()
Component
Component.applicationStarted(org.nuxeo.runtime.model.ComponentContext)
.
Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
getApplicationStartedOrder
in interface Component
public void start(ComponentContext context)
Component
start
in interface Component
start
in class DefaultComponent
public void stop(ComponentContext context) throws InterruptedException
Component
stop
in interface Component
stop
in class DefaultComponent
InterruptedException
public MigrationService.MigrationStatus getStatus(String id)
MigrationService
getStatus
in interface MigrationService
id
- the migration idnull
if the migration is unknownpublic void runStep(String id, String step)
MigrationService
This launches the migration asynchronously. The status of the migration can be checked with MigrationService.getStatus(java.lang.String)
.
runStep
in interface MigrationService
id
- the migration idstep
- the step idprotected MigrationService.StatusChangeNotifier getStatusChangeNotifier(String id)
protected MigrationService.StatusChangeNotifier getStatusChangeNotifier(MigrationDescriptor descr)
protected void atomic(String id, Consumer<KeyValueStore> consumer)
Copyright © 2018 Nuxeo. All rights reserved.