use of org.killbill.billing.payment.core.ProcessorBase.CallableWithAccountLock in project killbill by killbill.
the class OperationCallbackBase method dispatchWithAccountLockAndTimeout.
//
// Dispatch the Callable to the executor by first wrapping it into a CallableWithAccountLock
// The dispatcher may throw a TimeoutException, ExecutionException, or InterruptedException; those will be handled in specific
// callback to eventually throw a OperationException, that will be used to drive the state machine in the right direction.
//
protected <ExceptionType extends Exception> OperationResult dispatchWithAccountLockAndTimeout(final String pluginNames, final DispatcherCallback<PluginDispatcherReturnType<OperationResult>, ExceptionType> callback) throws OperationException {
final Account account = paymentStateContext.getAccount();
logger.debug("Dispatching plugin call for account {}", account.getExternalKey());
try {
final Callable<PluginDispatcherReturnType<OperationResult>> task = new CallableWithAccountLock<OperationResult, ExceptionType>(locker, account.getId(), paymentConfig, callback);
final OperationResult operationResult = PaymentPluginDispatcher.dispatchWithExceptionHandling(account, pluginNames, task, paymentPluginDispatcher);
return operationResult;
} catch (final PaymentApiException e) {
throw unwrapExceptionFromDispatchedTask(e);
}
}
Aggregations