public boolean reserve(Object object){
  reservedIdsLock.lock();
  if (reservedObjects.contains(object)) {
    reservedIdsLock.unlock();
    return false;
  }
  reservedObjects.add(object);
  reservedIdsLock.unlock();
  return true;
}

public boolean reserve ( Object object ) { reservedIdsLock . lock ( ) ; if ( reservedObjects . contains ( object ) ) { reservedIdsLock . unlock ( ) ; return false ; } reservedObjects . add ( object ) ; reservedIdsLock . unlock ( ) ; return true ; }
reserve an object , returning true when successfully reserved or false when the object is already reserved .
