oracle.portal.provider.v1
Class ProviderThreadMonitor

java.lang.Object
  |
  +--oracle.portal.provider.v1.ProviderThreadMonitor

public class ProviderThreadMonitor
extends java.lang.Object
implements java.lang.Runnable

A monitor class that stops any provider threads that are hanging. An object of this type is created in the servlet init() method and destroyed in the servlet destroy method. The monitor will periodically check if any threads in the internal list have elapsed. NOTE: This class used the deprecated Thread method, stop(). This is a last resort measure and is used to ensure that a hanging portlet does not consume server resources.


Constructor Summary
ProviderThreadMonitor(ProviderLog log, int debugLevel)
          Constructor
 
Method Summary
 void addThread(PortletExecutionTracker tracker, java.lang.Thread t)
          Add a provider thread to the list of threads to be monitored.
 void removeThread(PortletExecutionTracker pet)
          Remove a provider thread from the list to be monitored.
 void run()
          The main method for the provider monitor.
 void stopMonitor()
          Stop the thread monitor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProviderThreadMonitor

public ProviderThreadMonitor(ProviderLog log,
                             int debugLevel)
Constructor
Parameters:
log - a ProviderLog object for recording log messages
debugLevel - the servlet debug level
Method Detail

addThread

public void addThread(PortletExecutionTracker tracker,
                      java.lang.Thread t)
Add a provider thread to the list of threads to be monitored. Each thread is indexed by a PortletExecutionTracker.
Parameters:
t - the provider thread that will be stopped if it hangs
pet - an execution tracker

removeThread

public void removeThread(PortletExecutionTracker pet)
Remove a provider thread from the list to be monitored. This method is called from the client code when a provider thread has successfully completed execution.
Parameters:
pet - tracker object used as the index for the thread in the list.

stopMonitor

public void stopMonitor()
Stop the thread monitor. This should not be called if there are likely to be threads still in the internal list. If there are, it will check them one more time before exiting.

run

public void run()
The main method for the provider monitor. When there are provider threads to be monitored it will check each one in the list every 30 seconds to see if it needs to be stopped.
Specified by:
run in interface java.lang.Runnable