@InterfaceAudience.Private @InterfaceStability.Evolving public class ProcedureExecutor<TEnvironment> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ProcedureExecutor.FailedProcedure<TEnvironment> |
static interface |
ProcedureExecutor.ProcedureExecutorListener |
static class |
ProcedureExecutor.Testing |
| Modifier and Type | Field and Description |
|---|---|
static String |
CHECK_OWNER_SET_CONF_KEY |
static String |
WORKER_KEEP_ALIVE_TIME_CONF_KEY |
| Constructor and Description |
|---|
ProcedureExecutor(org.apache.hadoop.conf.Configuration conf,
TEnvironment environment,
ProcedureStore store) |
ProcedureExecutor(org.apache.hadoop.conf.Configuration conf,
TEnvironment environment,
ProcedureStore store,
ProcedureScheduler scheduler) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
abort(long procId)
Send an abort notification the specified procedure.
|
boolean |
abort(long procId,
boolean mayInterruptIfRunning)
Send an abort notification to the specified procedure.
|
void |
addChore(ProcedureInMemoryChore chore)
Add a chore procedure to the executor
|
NonceKey |
createNonceKey(long nonceGroup,
long nonce)
Create a NoneKey from the specified nonceGroup and nonce.
|
int |
getActiveExecutorCount() |
Set<Long> |
getActiveProcIds() |
int |
getCorePoolSize() |
TEnvironment |
getEnvironment() |
long |
getKeepAliveTime(TimeUnit timeUnit) |
protected long |
getLastProcId() |
<T extends Procedure> |
getProcedure(Class<T> clazz,
long procId) |
Procedure |
getProcedure(long procId) |
List<Procedure<?>> |
getProcedures()
Get procedures.
|
Procedure |
getResult(long procId) |
Procedure |
getResultOrProcedure(long procId) |
ProcedureStore |
getStore() |
int |
getWorkerThreadCount() |
boolean |
isFinished(long procId)
Return true if the procedure is finished.
|
boolean |
isProcedureOwner(long procId,
User user)
Check if the user is this procedure's owner
|
boolean |
isRunning() |
boolean |
isStarted(long procId)
Return true if the procedure is started.
|
void |
join() |
void |
refreshConfiguration(org.apache.hadoop.conf.Configuration conf) |
void |
registerListener(ProcedureExecutor.ProcedureExecutorListener listener) |
long |
registerNonce(NonceKey nonceKey)
Register a nonce for a procedure that is going to be submitted.
|
boolean |
removeChore(ProcedureInMemoryChore chore)
Remove a chore procedure from the executor
|
void |
removeResult(long procId)
Mark the specified completed procedure, as ready to remove.
|
void |
setFailureResultForNonce(NonceKey nonceKey,
String procName,
User procOwner,
IOException exception)
If the failure failed before submitting it, we may want to give back the
same error to the requests with the same nonceKey.
|
void |
setKeepAliveTime(long keepAliveTime,
TimeUnit timeUnit) |
void |
start(int numThreads,
boolean abortOnCorruption)
Start the procedure executor.
|
void |
stop() |
long |
submitProcedure(Procedure proc)
Add a new root-procedure to the executor.
|
long |
submitProcedure(Procedure proc,
NonceKey nonceKey)
Add a new root-procedure to the executor.
|
void |
submitProcedures(Procedure[] procs)
Add a set of new root-procedure to the executor.
|
boolean |
unregisterListener(ProcedureExecutor.ProcedureExecutorListener listener) |
void |
unregisterNonceIfProcedureWasNotSubmitted(NonceKey nonceKey)
Remove the NonceKey if the procedure was not submitted to the executor.
|
public static final String CHECK_OWNER_SET_CONF_KEY
public static final String WORKER_KEEP_ALIVE_TIME_CONF_KEY
public ProcedureExecutor(org.apache.hadoop.conf.Configuration conf,
TEnvironment environment,
ProcedureStore store)
public ProcedureExecutor(org.apache.hadoop.conf.Configuration conf,
TEnvironment environment,
ProcedureStore store,
ProcedureScheduler scheduler)
public void start(int numThreads,
boolean abortOnCorruption)
throws IOException
numThreads - number of threads available for procedure execution.abortOnCorruption - true if you want to abort your service in case
a corrupted procedure is found on replay. otherwise false.IOExceptionpublic void stop()
public void join()
public void refreshConfiguration(org.apache.hadoop.conf.Configuration conf)
public boolean isRunning()
public int getWorkerThreadCount()
public int getCorePoolSize()
public int getActiveExecutorCount()
public TEnvironment getEnvironment()
public ProcedureStore getStore()
public void setKeepAliveTime(long keepAliveTime,
TimeUnit timeUnit)
public long getKeepAliveTime(TimeUnit timeUnit)
public void addChore(ProcedureInMemoryChore chore)
chore - the chore to addpublic boolean removeChore(ProcedureInMemoryChore chore)
chore - the chore to removepublic NonceKey createNonceKey(long nonceGroup, long nonce)
nonceGroup - nonce - public long registerNonce(NonceKey nonceKey)
nonceKey - A unique identifier for this operation from the client or process.public void unregisterNonceIfProcedureWasNotSubmitted(NonceKey nonceKey)
nonceKey - A unique identifier for this operation from the client or process.public void setFailureResultForNonce(NonceKey nonceKey, String procName, User procOwner, IOException exception)
nonceKey - A unique identifier for this operation from the client or processprocName - name of the procedure, used to inform the userprocOwner - name of the owner of the procedure, used to inform the userexception - the failure to report to the userpublic long submitProcedure(Procedure proc)
proc - the new procedure to execute.public long submitProcedure(Procedure proc, NonceKey nonceKey)
proc - the new procedure to execute.nonceKey - the registered unique identifier for this operation from the client or process.public void submitProcedures(Procedure[] procs)
procs - the new procedures to execute.public boolean abort(long procId)
procId - the procedure to abortpublic boolean abort(long procId,
boolean mayInterruptIfRunning)
procId - the procedure to abortmayInterruptIfRunning - if the proc completed at least one step, should it be aborted?public Procedure getProcedure(long procId)
public Procedure getResult(long procId)
public boolean isFinished(long procId)
procId - the ID of the procedure to checkpublic boolean isStarted(long procId)
procId - the ID of the procedure to checkpublic void removeResult(long procId)
procId - the ID of the procedure to removepublic Procedure getResultOrProcedure(long procId)
public boolean isProcedureOwner(long procId,
User user)
procId - the target procedureuser - the userpublic List<Procedure<?>> getProcedures()
public void registerListener(ProcedureExecutor.ProcedureExecutorListener listener)
public boolean unregisterListener(ProcedureExecutor.ProcedureExecutorListener listener)
protected long getLastProcId()
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.