private interface ServiceOperation<T> {
T run(TaskService service) throws Exception;
};
private <T> T run(ServiceOperation<T> operation) throws DelegationException {
TaskService service = this.service;
try {
if (logger.isInfoEnabled()) {
logger.info(String.format("Running operation: %s", operation));
}
return operation.run(service);