threadMonitorFactory Method

In FileNet P8 4.0.0 and later, this method may be used to request the System Manager Listener to monitor a background thread.

This method creates a ThreadMonitor object for a background thread, where each object has a custom message String and an int time interval. When monitoring of a background thread is enabled, the ThreadMonitor facility starts to watch the clock. The background thread must ping the ThreadMonitor within the specified time interval (milliseconds). Less than interval milliseconds is fine, but more than interval milliseconds is too late. If a thread fails to ping the ThreadMonitor within the specified time interval, then the thread is assumed to have died, and the message is automatically broadcast by the ThreadMonitor as a CRITICAL level message.

During process execution, the value of the interval may be modified by the application using the setInterval method or retrieved using the getInterval method. When the value of interval is set to greater than zero, monitoring of the background thread is enabled. Monitoring of the background thread can be disabled at any time using the disable method, or by setting the interval value of the ThreadMonitor to zero.

For more information about monitoring background threads, see Tracking Background Threads.

Syntax
ThreadMonitor threadMonitorFactory(String message, int interval);
Parameters
message - [in] Required String, which provides the custom message to broadcast by the ThreadMonitor when a thread is assumed to have died. The string may be passed as Unicode that contains any printable characters, excluding the newline character.
interval - [in] Required int value that specifies the maximum number of milliseconds within which the background thread must ping the ThreadMonitor in order to be considered alive and well.
Example
Listener listener = new Listener("sampleApp", "4.0");
/* Create a monitored background thread that will
 * ping the ThreadMonitor at least every 15 seconds */
ThreadMonitor thread_one;
thread_one = listener.threadMonitorFactory("Background Thread 1", 15000);
...
See Also
Listener Class
ThreadMonitor Class
ping Method
disable Method
getInterval Method
setInterval Method