@InterfaceAudience.Private @InterfaceStability.Evolving public class ProcedureExecutor<TEnvironment> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ProcedureExecutor.FailedProcedureInfo |
static interface |
ProcedureExecutor.ProcedureExecutorListener |
static class |
ProcedureExecutor.Testing |
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,
ProcedureRunnableSet runqueue) |
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 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() |
TEnvironment |
getEnvironment() |
protected long |
getLastProcId() |
int |
getNumThreads() |
Procedure |
getProcedure(long procId) |
ProcedureInfo |
getResult(long procId) |
Pair<ProcedureInfo,Procedure> |
getResultOrProcedure(long procId) |
Map<Long,ProcedureInfo> |
getResults() |
protected ProcedureRunnableSet |
getRunnableSet() |
ProcedureStore |
getStore() |
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() |
List<ProcedureInfo> |
listProcedures()
List procedures.
|
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 |
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.
|
boolean |
unregisterListener(ProcedureExecutor.ProcedureExecutorListener listener) |
void |
unregisterNonceIfProcedureWasNotSubmitted(NonceKey nonceKey)
Remove the NonceKey if the procedure was not submitted to the executor.
|
public ProcedureExecutor(org.apache.hadoop.conf.Configuration conf, TEnvironment environment, ProcedureStore store)
public ProcedureExecutor(org.apache.hadoop.conf.Configuration conf, TEnvironment environment, ProcedureStore store, ProcedureRunnableSet runqueue)
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.IOException
public void stop()
public void join()
public boolean isRunning()
public int getNumThreads()
public int getActiveExecutorCount()
public TEnvironment getEnvironment()
public ProcedureStore getStore()
public void registerListener(ProcedureExecutor.ProcedureExecutorListener listener)
public boolean unregisterListener(ProcedureExecutor.ProcedureExecutorListener listener)
public List<ProcedureInfo> listProcedures()
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 ProcedureInfo 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 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 boolean isProcedureOwner(long procId, User user)
procId
- the target procedureuser
- the userpublic Map<Long,ProcedureInfo> getResults()
public Procedure getProcedure(long procId)
protected ProcedureRunnableSet getRunnableSet()
protected long getLastProcId()
public Pair<ProcedureInfo,Procedure> getResultOrProcedure(long procId)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.