private boolean lockOrder(Order order){
  lock.lock();
  try {
    return activeOrders.add(order.getId());
  }
  finally {
    lock.unlock();
  }
}

private boolean lockOrder ( Order order ) { lock . lock ( ) ; try { return activeOrders . add ( order . getId ( ) ) ; } finally { lock . unlock ( ) ; } }
attempts the lock the order . if the order is already active this returns false .
