public void contributeRequestExceptionHandler(OperationQueue operationQueue, MappedConfiguration<Class<?>, Class<?>>Object> configuration) {
final ExceptionHandlerAssistant assistant = new ExceptionHandlerAssistant() {
@Override
public Object handleRequestException(Throwable exception, List<Object> exceptionContext) throws IOException {
ServiceException serviceException = (ServiceException)exception;
if (serviceException.isInterruptedOperationRecoverable()) {
operationQueue.add(serviceException.getInterruptedOperation());
return OperationScheduled.class;
}
else return ServiceUnavailable.class;
}
};
configuration.add(ServiceException.class, assistant);
} |