| Constructor and Description |
|---|
Job(DataReader reader,
DataWriter writer) |
| Modifier and Type | Method and Description |
|---|---|
static void |
addJobLifecycleListener(JobLifecycleListener listener) |
Job |
cancel() |
protected Object |
clone() |
static List<Job> |
getAll()
Returns all the live jobs in the JVM/classloader.
|
JobCallback<DataReader,DataWriter> |
getCallback() |
Date |
getCancelledOn()
Returns the time this job instance was cancelled.
|
Job |
getChild()
Returns the thread-local child job of this one while this job is running.
|
Date |
getCreatedOn()
Returns the time this job instance was created.
|
static Job |
getCurrent()
Returns the job currently running in this thread.
|
DataException |
getException()
Returns the last exception thrown while running.
|
Date |
getFinishedOn()
Returns the time this job finished running.
|
long |
getId()
Returns the unique (sequential) ID of this job (within this JVM/classloader).
|
static int |
getJobCount()
Returns the current number of live jobs in the JVM/classloader.
|
Record |
getLastRecord()
Returns the most recent record seen by this job while it is running or
null. |
DataWriter |
getLogWriter() |
String |
getName()
Returns the name assigned to this job or its default name if one was not assigned.
|
Job |
getParent()
Returns the thread-local job that ran this one while this job is running.
|
Date |
getPausedOn()
Returns the time this job was paused or
null if this job is not currently paused. |
DataReader |
getReader()
Returns the reader supplied to this job.
|
<T extends DataReader> |
getReader(Class<T> type)
Returns the first reader of the supplied type from the read pipeline.
|
List<DataReader> |
getReaders()
Returns the read pipeline — the chain of readers records pass through, starting with the root instance and ending with the reader passed to this job (and returned by
getReader()). |
long |
getRecordsTransferred()
Returns the number of records sent from the supplied reader to the supplied writer.
|
long |
getRunningTime()
Returns the number of milliseconds this job was (or has been) running for or zero (0) if it hasn't yet started running.
|
String |
getRunningTimeAsString()
Returns the time this job was (or has been) running in long form as a human readable string (2 Years, 1 Second, 12 Millisecond) or
null if it hasn't yet started running. |
String |
getRunningTimeAsString(boolean shortForm)
Returns the time this job was (or has been) running as a human readable string in long form (2 Years, 1 Second, 12 Millisecond) or short form (2y 1s 12ms) or
null if it hasn't yet started running. |
Thread |
getRunThread()
Returns the thread currently executing this job or
null if the job is not running. |
Date |
getStartedOn()
Returns the time this job instance started running.
|
UUID |
getUuid()
Returns the universally unique identifier (UUID) for this job.
|
DataWriter |
getWriter()
Returns the writer supplied to this job.
|
<T extends DataWriter> |
getWriter(Class<T> type)
Returns the first writer of the supplied type from the write pipeline.
|
List<DataWriter> |
getWriters()
Returns the write pipeline — the chain of writers records pass through, starting with the writer passed to this job and returned by
getWriter() and ending with the root instance. |
boolean |
hasCallback() |
boolean |
isAutoCloseLogWriter() |
boolean |
isCancelled()
Returns
true if this job was cancelled. |
boolean |
isFailed()
Returns
true if this job has completed unsuccessfully. |
boolean |
isFinished()
Returns
true if this job has finished running. |
boolean |
isPaused()
Returns
true if this job is currently paused. |
boolean |
isRunning()
Returns
true if this job is currently running. |
Job |
log() |
protected void |
onFinish()
Called when this job finishes.
|
protected void |
onPause()
Called when this job is paused.
|
protected void |
onStart()
Called when this job starts.
|
Job |
pause() |
static void |
removeJobLifecycleListener(JobLifecycleListener listener) |
Job |
resume() |
void |
run()
Executes this job in the current thread.
|
static Job |
run(DataReader reader,
DataWriter writer) |
static Job |
run(DataReader reader,
DataWriter writer,
JobCallback<DataReader,DataWriter> callback) |
Job |
runAsync()
Executes this job in a new thread.
|
static Job |
runAsync(DataReader reader,
DataWriter writer) |
static Job |
runAsync(DataReader reader,
DataWriter writer,
JobCallback<DataReader,DataWriter> callback) |
Job |
setAutoCloseLogWriter(boolean autoCloseLogWriter) |
Job |
setCallback(JobCallback<DataReader,DataWriter> callback) |
Job |
setLogWriter(DataWriter logWriter) |
Job |
setName(String name)
Assigns a new name to this job.
|
String |
toDebugString() |
String |
toString() |
Job |
waitUntilFinished()
Waits for this job to complete.
|
Job |
waitUntilFinished(long timeout)
Waits up to
timeout milliseconds for this job to complete or throws InterruptedException. |
Job |
waitUntilStarted()
Waits for this job to start.
|
Job |
waitUntilStarted(long timeout)
Waits up to
timeout milliseconds for this job to start or throws InterruptedException. |
public Job(DataReader reader, DataWriter writer)
public static void addJobLifecycleListener(JobLifecycleListener listener)
public static void removeJobLifecycleListener(JobLifecycleListener listener)
public static Job run(DataReader reader, DataWriter writer)
public static Job run(DataReader reader, DataWriter writer, JobCallback<DataReader,DataWriter> callback)
public static Job runAsync(DataReader reader, DataWriter writer)
public static Job runAsync(DataReader reader, DataWriter writer, JobCallback<DataReader,DataWriter> callback)
public static Job getCurrent()
public static int getJobCount()
public Job getParent()
public Job getChild()
public long getId()
public UUID getUuid()
public String getName()
public DataReader getReader()
public <T extends DataReader> T getReader(Class<T> type)
public DataWriter getWriter()
public <T extends DataWriter> T getWriter(Class<T> type)
public List<DataReader> getReaders()
getReader()).public List<DataWriter> getWriters()
getWriter() and ending with the root instance.public Date getCreatedOn()
getCreatedOn in interface IJobpublic Date getStartedOn()
getStartedOn in interface IJobpublic Date getCancelledOn()
getCancelledOn in interface IJobpublic boolean isCancelled()
true if this job was cancelled.isCancelled in interface IJobpublic Date getPausedOn()
null if this job is not currently paused.getPausedOn in interface IJobpublic boolean isPaused()
true if this job is currently paused.public Date getFinishedOn()
getFinishedOn in interface IJobpublic boolean isFinished()
true if this job has finished running.isFinished in interface IJobpublic DataException getException()
getException in interface IJobpublic boolean isFailed()
true if this job has completed unsuccessfully.public Thread getRunThread()
null if the job is not running.getRunThread in interface IJobpublic boolean isRunning()
true if this job is currently running.public long getRunningTime()
getRunningTime in interface IJobpublic String getRunningTimeAsString()
null if it hasn't yet started running.getRunningTimeAsString in interface IJobpublic String getRunningTimeAsString(boolean shortForm)
null if it hasn't yet started running.getRunningTimeAsString in interface IJobpublic long getRecordsTransferred()
public Record getLastRecord()
null.public JobCallback<DataReader,DataWriter> getCallback()
public boolean hasCallback()
public Job setCallback(JobCallback<DataReader,DataWriter> callback)
protected void onStart()
protected void onFinish()
protected void onPause()
public Job setLogWriter(DataWriter logWriter)
public DataWriter getLogWriter()
public boolean isAutoCloseLogWriter()
public Job setAutoCloseLogWriter(boolean autoCloseLogWriter)
public Job log()
public void run()
public Job runAsync()
public Job waitUntilStarted() throws InterruptedException
waitUntilStarted in interface IJobInterruptedExceptionpublic Job waitUntilStarted(long timeout) throws InterruptedException
timeout milliseconds for this job to start or throws InterruptedException.waitUntilStarted in interface IJobInterruptedExceptionpublic Job waitUntilFinished() throws InterruptedException
waitUntilFinished in interface IJobInterruptedExceptionpublic Job waitUntilFinished(long timeout) throws InterruptedException
timeout milliseconds for this job to complete or throws InterruptedException.waitUntilFinished in interface IJobInterruptedExceptionprotected Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic String toDebugString()
Copyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.