Package DE_EPAGES::Core::API::Object::MonitorShared
provides a facility to report status of long-running processes
Functions
- blockTimeOut
- finish
- finishedContent
- isBlocked
- isStarted
- monitorContent
- new
- run
- start
- timeout
- writeMonitorContent
blockTimeOut
if the main thread dont want that the monitor start, it calls this function. monitor sets internal state blocked if not started yet.
Syntax |
$Monitor->blockTimeOut; |
finish
Called by run after the processing funtion has finished and timeout was called.
Syntax |
$Monitor->finish; |
finishedContent
Returns the content of the last monitor page.
Syntax |
$Content = $Monitor->finishedContent; |
Return |
|
isBlocked
Returns true if monitor is blocked. In this case the monitor will ignore the timeout and proceed with the normal processing.
Syntax |
$IsBlocked = $Monitor->isBlocked; |
Example |
if( $Monitor->isBlocked ) { ... }; |
Return |
|
isStarted
Returns true if the monitor is started, i.e. timeout has been called.
Syntax |
$IsStarted = $Monitor->isStarted; |
Example |
if( $Monitor->isStarted ) { ... }; |
Return |
|
monitorContent
Returns the content of the monitor page.
Syntax |
$Content = $Monitor->monitorContent; |
Return |
|
new
Create a new monitor object, which covers the content pages and is triggered at timeout and response.
Syntax |
$Servlet = DE_EPAGES::Core::API::Object::MonitorShared->new(%Options); |
Example |
$Servlet = DE_EPAGES::Core::API::Object::MonitorShared->new( MonitorContentSub => sub { my ($Monitor) = @_; return 'processing'; } FinishedContentSub => sub { my ($Monitor) = @_; return 'finished'; } |
Input |
|
Return |
|
run
Runs a potentially long-running function. Calls timeout when the timout was reached before the function ends. If timeout was called, then finish is called at the end, even if there was an error.
Syntax |
$Monitor->run($Sub, $Timeout); |
Input |
|
start
Starts the monitor and writes the first monitor content. This method can be used even if the monitor timeout is blocked.
Syntax |
$Monitor->start; |
timeout
Called by the monitor thread to signal a timeout.
Syntax |
$Monitor->timeout; |
writeMonitorContent
Prints the content of the monitor page to the console.
Syntax |
$Monitor->writeMonitorContent; |