001/* [{ 002Copyright 2010 Nicolas Carranza <nicarran at gmail.com> 003 004This file is part of jpen. 005 006jpen is free software: you can redistribute it and/or modify 007it under the terms of the GNU Lesser General Public License as published by 008the Free Software Foundation, either version 3 of the License, 009or (at your option) any later version. 010 011jpen is distributed in the hope that it will be useful, 012but WITHOUT ANY WARRANTY; without even the implied warranty of 013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014GNU Lesser General Public License for more details. 015 016You should have received a copy of the GNU Lesser General Public License 017along with jpen. If not, see <http://www.gnu.org/licenses/>. 018}] */ 019package jpen.internal; 020 021public final class ObjectUtils{ 022 private ObjectUtils(){} 023 024 public static void synchronizedWait(Object lock, long timeout){ 025 synchronized(lock){ 026 waitUninterrupted(lock, timeout); 027 } 028 } 029 030 public static void waitUninterrupted(Object o, long timeout){ 031 try{ 032 o.wait(timeout); 033 }catch(InterruptedException ex){ 034 throw new AssertionError(ex); 035 } 036 } 037 038 public static void waitUninterrupted(Object lock){ 039 waitUninterrupted(lock, 0l); 040 } 041}