/*
* Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.yangtools.util.concurrent;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.AbstractCheckedFuture;
import com.google.common.util.concurrent.ListenableFuture;
/**
* An implementation of CheckedFuture that provides similar behavior for the get
methods
* that the checkedGet
methods provide.
*
* For {@link CancellationException} and {@link InterruptedException}, the specified exception mapper * is invoked to translate them to the checked exception type. *
* For {@link ExecutionException}, the mapper is invoked to translate the cause to the checked exception
* and a new ExecutionException is thrown with the translated cause.
*
* @author Thomas Pantelis
*
* @param MappingCheckedFuture
that wraps the given {@link ListenableFuture}
* delegate.
*
* @param delegate the {@link ListenableFuture} to wrap
* @param mapper the mapping {@link Function} used to translate exceptions from the delegate
* @return a new MappingCheckedFuture
*/
public static