org.ourgrid.test.threadServices
Class MonitoredObject

java.lang.Object
  extended by org.ourgrid.test.threadServices.MonitoredObject

public class MonitoredObject
extends java.lang.Object

This class represents an object and the threads waiting for it.


Constructor Summary
MonitoredObject(java.lang.Object o)
          Constructor.
MonitoredObject(java.lang.Object o, java.lang.Thread t)
          Constructor.
 
Method Summary
 boolean addThread(java.lang.Thread t)
          Adds a certain Thread to the list of threads waiting for an object.
 java.util.Map<java.lang.String,java.lang.Thread> getMonitoringThreads()
          Gets the Map storing threads waiting for an object notify or notifyAll.
 java.util.Iterator getMonitoringThreadsIterator()
          Gets the list of threads waiting for an object notify or notifyAll.
 boolean isMonitoredBy(java.lang.Thread t)
          Verifies if an object is monitored by a certain Thread.
 java.lang.String toString()
          Gets a String that represents this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MonitoredObject

public MonitoredObject(java.lang.Object o)
Constructor.

Parameters:
o - The object being monitored.

MonitoredObject

public MonitoredObject(java.lang.Object o,
                       java.lang.Thread t)
Constructor.

Parameters:
o - The object being monitored (where a wait was called).
t - The thread waiting for the object.
Method Detail

isMonitoredBy

public boolean isMonitoredBy(java.lang.Thread t)
Verifies if an object is monitored by a certain Thread.

Parameters:
t - The Thread we want to know if it is monitored.
Returns:
true if while t was running, a wait on a certain object was called.

addThread

public boolean addThread(java.lang.Thread t)
Adds a certain Thread to the list of threads waiting for an object.

Parameters:
t - The Thread.
Returns:
true, if t was not monitoring this object, and false otherwise.

getMonitoringThreadsIterator

public java.util.Iterator getMonitoringThreadsIterator()
Gets the list of threads waiting for an object notify or notifyAll.

Returns:
the list of threads waiting for an object notify or notifyAll.

getMonitoringThreads

public java.util.Map<java.lang.String,java.lang.Thread> getMonitoringThreads()
Gets the Map storing threads waiting for an object notify or notifyAll.

Returns:
the Map storing threads waiting for an object notify or notifyAll.

toString

public java.lang.String toString()
Gets a String that represents this object.

Overrides:
toString in class java.lang.Object
Returns:
the textual representation of this object.