Package com.saperion.ngc.servlet.process
Class LongRunningProcess
java.lang.Object
java.lang.Thread
com.saperion.ngc.servlet.process.LongRunningProcess
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
ExportProcess
,PdfRenderProcess
Abstract class for processes that might take a long time to run.
The processes are executed by the
LongRunningProcessServlet
.
Because a LongRunningProcess is a thread, classes that extend this
class must override Thread.run()
.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LRPControlBean
Control bean for this process.protected boolean
If the process was canceled.protected NewConnectionClassicConnectorProvider
Connection provider that provides a new connection for this process.static final String
Name of the session attribute used to store the control bean for long running processes.protected boolean
If an error occurred.protected int
Current progress (percent).protected final jakarta.servlet.http.HttpSession
Current session.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionLongRunningProcess
(LRPControlBean bean, jakarta.servlet.http.HttpSession session) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels the process.int
boolean
isError()
protected void
updateProgress
(int currentElement, int totalElements) Updates the progress.abstract void
writeResult
(jakarta.servlet.http.HttpServletResponse response) Writes the result of the process to the output-stream.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
CONTROL_BEAN_SESSION_ATTR
Name of the session attribute used to store the control bean for long running processes.- See Also:
-
bean
Control bean for this process. -
session
protected final jakarta.servlet.http.HttpSession sessionCurrent session. -
progress
protected int progressCurrent progress (percent). -
error
protected boolean errorIf an error occurred. -
canceled
protected boolean canceledIf the process was canceled. -
connectionProvider
Connection provider that provides a new connection for this process. Each process must take care of logging-off the connector when it is no longer in use.
-
-
Constructor Details
-
LongRunningProcess
- Parameters:
bean
- bean containing information for the processsession
- the current session
-
-
Method Details
-
writeResult
public abstract void writeResult(jakarta.servlet.http.HttpServletResponse response) throws IOException, SystemException Writes the result of the process to the output-stream.- Parameters:
response
- servlet response to write to- Throws:
IOException
- IO Exception when writingSystemException
- generic exception when writing
-
updateProgress
protected void updateProgress(int currentElement, int totalElements) Updates the progress.- Parameters:
currentElement
- element currently being processedtotalElements
- total number of elements
-
getProgress
public int getProgress()- Returns:
- the current progress
-
isError
public boolean isError()- Returns:
- true if an error occurred
-
cancel
public void cancel()Cancels the process.
-