Package org.kie.api.executor
Interface Executor
-
public interface Executor
Core logic of executor is encapsulated by this interface. It allows to operate on request instances of the execution.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cancelRequest(Long requestId)
Cancels active (queued, running or retrying) requestvoid
destroy()
Destroys executorint
getInterval()
int
getRetries()
int
getThreadPoolSize()
TimeUnit
getTimeunit()
void
init()
Initialized executorLong
scheduleRequest(String commandName, Date date, CommandContext ctx)
Schedules execution of given command on defined time.Long
scheduleRequest(String commandName, CommandContext ctx)
Schedules execution of given command as soon as possible.void
setInterval(int waitTime)
Sets interval at which executor threads are running.void
setRetries(int defaultNroOfRetries)
Sets default number of retries that shall be attempted in case of an error.void
setThreadPoolSize(int nroOfThreads)
Sets default executor thread pool size.void
setTimeunit(TimeUnit timeunit)
Sets time unit for executor intervalsvoid
updateRequestData(Long requestId, Map<String,Object> data)
Updates request data by merging existing (if any) with given.
-
-
-
Method Detail
-
scheduleRequest
Long scheduleRequest(String commandName, CommandContext ctx)
Schedules execution of given command as soon as possible.- Parameters:
commandName
- - FQCN of the commandctx
- - contextual data given by executor service- Returns:
- unique identifier of the request
-
scheduleRequest
Long scheduleRequest(String commandName, Date date, CommandContext ctx)
Schedules execution of given command on defined time.- Parameters:
commandName
- - FQCN of the commanddate
- - date at which given command shall be executedctx
- - contextual data given by executor service- Returns:
- unique identifier of the request
-
cancelRequest
void cancelRequest(Long requestId)
Cancels active (queued, running or retrying) request- Parameters:
requestId
- - id of the request to cancel
-
getInterval
int getInterval()
- Returns:
- configured interval at which executor threads are running
-
setInterval
void setInterval(int waitTime)
Sets interval at which executor threads are running. Should not be used afterinit
method has been called.- Parameters:
waitTime
-
-
getRetries
int getRetries()
- Returns:
- configured default number of retries that shall be attempted in case of an error
-
setRetries
void setRetries(int defaultNroOfRetries)
Sets default number of retries that shall be attempted in case of an error. Should not be used afterinit
method has been called.- Parameters:
defaultNroOfRetries
-
-
getThreadPoolSize
int getThreadPoolSize()
- Returns:
- configured executor thread pool size
-
setThreadPoolSize
void setThreadPoolSize(int nroOfThreads)
Sets default executor thread pool size. Should not be used afterinit
method has been called.- Parameters:
nroOfThreads
-
-
getTimeunit
TimeUnit getTimeunit()
- Returns:
- time unit configured for executor intervals
-
setTimeunit
void setTimeunit(TimeUnit timeunit)
Sets time unit for executor intervals- Parameters:
timeunit
-
-
init
void init()
Initialized executor
-
destroy
void destroy()
Destroys executor
-
updateRequestData
void updateRequestData(Long requestId, Map<String,Object> data)
Updates request data by merging existing (if any) with given. Only allowed for not completed requests (including those in error state).- Parameters:
requestId
- unique id of the request to be updateddata
- data to be set on the job
-
-