public abstract class AbstractOfficeManagerPool<E extends AbstractOfficeManagerPoolEntry> extends Object implements OfficeManager, TemporaryFileMaker
AbstractOfficeManagerPoolEntry that will be used to execute OfficeTask. The pool will use the first available AbstractOfficeManagerPoolEntry to execute a given task when the
execute(org.jodconverter.core.task.OfficeTask) function is called.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractOfficeManagerPool.AbstractOfficeManagerPoolBuilder<B extends AbstractOfficeManagerPool.AbstractOfficeManagerPoolBuilder<B>>
A builder for constructing an
AbstractOfficeManagerPool. |
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_TASK_EXECUTION_TIMEOUT |
static long |
DEFAULT_TASK_QUEUE_TIMEOUT |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractOfficeManagerPool(int poolSize,
@NonNull File workingDir,
long taskQueueTimeout)
Constructs a new instance of the class with the specified settings.
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute(@NonNull OfficeTask task)
Executes the specified task and blocks until the task terminates.
|
boolean |
isRunning()
Gets whether the manager is running.
|
@NonNull File |
makeTemporaryFile()
Creates a new temporary file without an extension.
|
@NonNull File |
makeTemporaryFile(@Nullable String extension)
Creates a new temporary file with the specified extension.
|
protected void |
setEntries(@NonNull List<E> entries)
Sets the manager entries.
|
void |
start()
Starts the manager.
|
void |
stop()
Stops the manager.
|
public static final long DEFAULT_TASK_QUEUE_TIMEOUT
public static final long DEFAULT_TASK_EXECUTION_TIMEOUT
protected AbstractOfficeManagerPool(int poolSize,
@NonNull File workingDir,
long taskQueueTimeout)
poolSize - The pool size.workingDir - The directory where temporary files and directories are created.taskQueueTimeout - The maximum living time of a task in the conversion queue. The task
will be removed from the queue if the waiting time is longer than this timeout.protected void setEntries(@NonNull List<E> entries)
entries - The entries.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.public final boolean isRunning()
OfficeManagerisRunning in interface OfficeManagertrue if the manager is running, false otherwise.public final void execute(@NonNull OfficeTask task) throws OfficeException
OfficeManagerexecute in interface OfficeManagertask - The task to execute.OfficeException - If an error occurs.public @NonNull File makeTemporaryFile()
TemporaryFileMakermakeTemporaryFile in interface TemporaryFileMakerpublic @NonNull File makeTemporaryFile(@Nullable String extension)
TemporaryFileMakermakeTemporaryFile in interface TemporaryFileMakerextension - the extension of the file to create.Copyright © 2016 - present; JODConverter.org. All rights reserved.