import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
/**
- * A {@link Future} used to report the status of an future {@link java.util.concurrent.Future}.
+ * A {@link java.util.concurrent.Future} used to report the status of an future
+ * {@link java.util.concurrent.Future}.
*/
final class PingPongFuture extends AbstractCheckedFuture<Void, TransactionCommitFailedException> {
- protected PingPongFuture(final ListenableFuture<Void> delegate) {
- super(delegate);
- }
+ protected PingPongFuture(final ListenableFuture<Void> delegate) {
+ super(delegate);
+ }
- @Override
- protected TransactionCommitFailedException mapException(final Exception e) {
- if (e.getCause() instanceof TransactionCommitFailedException){
- return (TransactionCommitFailedException) e.getCause();
- } else {
- return new TransactionCommitFailedException(e.getMessage(), e.getCause(), null);
+ @Override
+ protected TransactionCommitFailedException mapException(final Exception exception) {
+ final Throwable cause = exception.getCause();
+ if (cause instanceof TransactionCommitFailedException) {
+ return (TransactionCommitFailedException) cause;
+ } else {
+ return new TransactionCommitFailedException(exception.getMessage(), cause);
+ }
}
- }
}