public static void wait(Object obj,long timeout){
synchronized (obj) {
    try {
      obj.wait(timeout);
    }
 catch (    InterruptedException inex) {
    }
  }
}

public static void wait ( Object obj , long timeout ) { synchronized ( obj ) { try { obj . wait ( timeout ) ; } catch ( InterruptedException inex ) { } } }
waits for a object or a timeout for synchronization purposes .
