public abstract class AbstractOfficeManagerPoolEntry extends Object implements OfficeManager
An important note here is to keep in mind that subclasses are responsible to manage the availability of the task executor. This abstract class never set the availability to true. Only when the manager is stopped that the availability is set to false.
OfficeManager,
AbstractOfficeManagerPool| Modifier | Constructor and Description |
|---|---|
protected |
AbstractOfficeManagerPoolEntry(long taskExecutionTimeout)
Initializes a new pool entry with the specified configuration.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
cancelTask()
Cancels the current running task, if any.
|
protected abstract void |
doExecute(@NonNull OfficeTask task)
Performs the execution of a task.
|
protected abstract void |
doStart()
Allow subclasses to perform operation when the office manager is started.
|
protected abstract void |
doStop()
Allow subclasses to perform operation when the office manager is stopped.
|
void |
execute(@NonNull OfficeTask task)
Executes the specified task and blocks until the task terminates.
|
protected void |
handleExecuteTimeoutException(@NonNull TimeoutException timeoutEx)
Handles a timeout exception raised while executing a task.
|
boolean |
isRunning()
Gets whether the manager is running.
|
protected void |
setAvailable(boolean available)
Sets the availability of this manager entry.
|
void |
start()
Starts the manager.
|
void |
stop()
Stops the manager.
|
protected AbstractOfficeManagerPoolEntry(long taskExecutionTimeout)
taskExecutionTimeout - The maximum time allowed to process a task. If the processing time
of a task is longer than this timeout, this task will be aborted and the next task is
processed.public final void execute(@NonNull OfficeTask task) throws OfficeException
OfficeManagerexecute in interface OfficeManagertask - The task to execute.OfficeException - If an error occurs.protected abstract void doExecute(@NonNull OfficeTask task) throws OfficeException
task - The task to execute.OfficeException - If any errors occurs during the conversion.protected void handleExecuteTimeoutException(@NonNull TimeoutException timeoutEx)
timeoutEx - the exception thrown.public boolean isRunning()
OfficeManagerisRunning in interface OfficeManagertrue if the manager is running, false otherwise.public final void start()
throws OfficeException
OfficeManagerstart in interface OfficeManagerOfficeException - If the manager cannot be started.public final void stop()
throws OfficeException
OfficeManagerstop in interface OfficeManagerOfficeException - If the manager cannot be stopped.protected void cancelTask()
protected void setAvailable(boolean available)
available - true if the manager is available to execute tasks, false
otherwise.protected abstract void doStart()
throws OfficeException
OfficeException - If an error occurred while starting the manager.protected abstract void doStop()
throws OfficeException
OfficeException - If an error occurred while stopping the manager.Copyright © 2016 - present; JODConverter.org. All rights reserved.