|
Compoze Software, Inc. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.compoze.util.ObjectMonitor
This class is used for monitoring a wait/notify scenario. For example:
public class Checker
{
private ObjectMonitor m_monitor;
public void getObject()
{
m_monitor = new ObjectMonitor();
//some code that will end up calling doneCalling();
synchronized(m_monitor)
{
m_monitor.setPassed(false);
while (!m_monitor.isPassed())
{
try { m_monitor.wait(); }
catch (InterruptedException e) { }
}
}
// some code to finish out this method ...
}
public void doneCalling()
{
synchronized(m_monitor)
{
m_monitor.setPassed(true);
m_monitor.notify(); // releases the wait above.
}
}
}
| Constructor Summary | |
ObjectMonitor()
Constructor. |
|
ObjectMonitor(boolean bInitialState)
Constructor. |
|
| Method Summary | |
boolean |
isPassed()
Return if the criteria has passed |
void |
setPassed(boolean bPassed)
Set whether the criteria has passed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ObjectMonitor()
new ObjectMonitor(false).
public ObjectMonitor(boolean bInitialState)
bInitialState - The initial pass/fail state.| Method Detail |
public void setPassed(boolean bPassed)
public boolean isPassed()
|
Compoze Software, Inc. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||