if (getErrorInsteadOfQueue()) {
lockObject = orderLockManager.acquireLockIfAvailable(order);
if (lockObject == null) {
// We weren't able to acquire the lock immediately because some other thread has it. Because the
// order.lock.errorInsteadOfQueue property was set to true, we're going to throw an exception now.
throw new OrderLockAcquisitionFailureException("Thread[" + Thread.currentThread().getId() +
"] could not acquire lock for order[" + order.getId() + "]");
}
} else {
lockObject = orderLockManager.acquireLock(order);
}