Class StandaloneCommandExecutor
java.lang.Object
com.linecorp.centraldogma.server.command.AbstractCommandExecutor
com.linecorp.centraldogma.server.command.StandaloneCommandExecutor
- All Implemented Interfaces:
CommandExecutor
A
CommandExecutor implementation which performs operations on the local storage.-
Constructor Summary
ConstructorsConstructorDescriptionStandaloneCommandExecutor(ProjectManager projectManager, Executor repositoryWorker, ServerStatusManager serverStatusManager, @Nullable SessionManager sessionManager, EncryptionStorageManager encryptionStorageManager, @Nullable Consumer<CommandExecutor> onTakeLeadership, @Nullable Consumer<CommandExecutor> onReleaseLeadership, @Nullable Consumer<CommandExecutor> onTakeZoneLeadership, @Nullable Consumer<CommandExecutor> onReleaseZoneLeadership) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> CompletableFuture<T> doExecute(ExecutionContext ctx, Command<T> command) Executes the specifiedCommand.protected voiddoStart(@Nullable Runnable onTakeLeadership, @Nullable Runnable onReleaseLeadership, @Nullable Runnable onTakeZoneLeadership, @Nullable Runnable onReleaseZoneLeadership) Starts theCommandExecutor.protected voidStops theCommandExecutor.intReturns the ID of a replica.Methods inherited from class AbstractCommandExecutor
execute, isStarted, isStopping, isWritable, setWritable, start, statusManager, stop, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CommandExecutor
execute
-
Constructor Details
-
StandaloneCommandExecutor
public StandaloneCommandExecutor(ProjectManager projectManager, Executor repositoryWorker, ServerStatusManager serverStatusManager, @Nullable SessionManager sessionManager, EncryptionStorageManager encryptionStorageManager, @Nullable Consumer<CommandExecutor> onTakeLeadership, @Nullable Consumer<CommandExecutor> onReleaseLeadership, @Nullable Consumer<CommandExecutor> onTakeZoneLeadership, @Nullable Consumer<CommandExecutor> onReleaseZoneLeadership) Creates a new instance.- Parameters:
projectManager- the project manager for accessing the storagerepositoryWorker- the executor which is used for performing storage operationssessionManager- the session manager for creating/removing a sessiononTakeLeadership- the callback to be invoked after the replica has taken the leadershiponReleaseLeadership- the callback to be invoked before the replica releases the leadershiponTakeZoneLeadership- the callback to be invoked after the replica has taken the zone leadershiponReleaseZoneLeadership- the callback to be invoked before the replica releases the zone leadership
-
-
Method Details
-
replicaId
public int replicaId()Description copied from interface:CommandExecutorReturns the ID of a replica. -
doStart
protected void doStart(@Nullable Runnable onTakeLeadership, @Nullable Runnable onReleaseLeadership, @Nullable Runnable onTakeZoneLeadership, @Nullable Runnable onReleaseZoneLeadership) Description copied from class:AbstractCommandExecutorStarts theCommandExecutor.- Specified by:
doStartin classAbstractCommandExecutor
-
doStop
protected void doStop(@Nullable Runnable onReleaseLeadership, @Nullable Runnable onReleaseZoneLeadership) Description copied from class:AbstractCommandExecutorStops theCommandExecutor.- Specified by:
doStopin classAbstractCommandExecutor
-
doExecute
protected <T> CompletableFuture<T> doExecute(ExecutionContext ctx, Command<T> command) throws Exception Description copied from class:AbstractCommandExecutorExecutes the specifiedCommand.- Specified by:
doExecutein classAbstractCommandExecutor- Throws:
Exception
-