Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.thread
Class ThreadWatchdog

java.lang.Object
  extended by org.hyperic.util.thread.ThreadWatchdog

public class ThreadWatchdog
extends java.lang.Object

This class is able to interrupt threads after a certain interval -- useful when threads need to have a bounded runtime.


Nested Class Summary
static class ThreadWatchdog.InterruptToken
           
 
Constructor Summary
ThreadWatchdog(java.lang.String threadName)
           
 
Method Summary
 void cancelInterrupt(ThreadWatchdog.InterruptToken t)
          Cancel a scheduled interrupt.
 void initialize()
          Must be called prior to any other use of this object.
 ThreadWatchdog.InterruptToken interruptMeIn(long delay, java.util.concurrent.TimeUnit units, java.lang.String targetMsg)
          Schedule an interrupt for the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadWatchdog

public ThreadWatchdog(java.lang.String threadName)
Method Detail

initialize

public void initialize()
Must be called prior to any other use of this object.


interruptMeIn

public ThreadWatchdog.InterruptToken interruptMeIn(long delay,
                                                   java.util.concurrent.TimeUnit units,
                                                   java.lang.String targetMsg)
Schedule an interrupt for the current thread.

Parameters:
delay - The # of units to delay
units - Combines with 'delay' to give the length of time to delay
targetMsg - An informational message about what the current thread is doing, used when logging an interrupt.

cancelInterrupt

public void cancelInterrupt(ThreadWatchdog.InterruptToken t)
Cancel a scheduled interrupt.


Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.