Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.util
Class ObjectMonitor

    java.lang.Object
      com.compoze.util.ObjectMonitor

public class ObjectMonitor
extends java.lang.Object

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

### ObjectMonitor

    public ObjectMonitor()

  Constructor. This is the same as calling `new ObjectMonitor(false)`.

### ObjectMonitor

    public ObjectMonitor(boolean bInitialState)

  Constructor.

Parameters:
  `bInitialState` - The initial pass/fail state.

Method Detail

### setPassed

    public void setPassed(boolean bPassed)

  Set whether the criteria has passed.

### isPassed

    public boolean isPassed()

  Return if the criteria has passed

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.