Bug 7786 Delete and re add of access port handling
[netvirt.git] / vpnservice / elanmanager / elanmanager-impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / utils / SettableFutureCallback.java
1 /*
2  * Copyright © 2016, 2017 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netvirt.elan.l2gw.utils;
9
10 import com.google.common.util.concurrent.FutureCallback;
11 import com.google.common.util.concurrent.SettableFuture;
12
13 public class SettableFutureCallback<T> implements FutureCallback<T> {
14
15     private final SettableFuture<T> settableFuture;
16
17     public SettableFutureCallback(SettableFuture<T> settableFuture) {
18         this.settableFuture = settableFuture;
19     }
20
21     @Override
22     public void onSuccess(T objT) {
23         settableFuture.set(objT);
24     }
25
26     @Override
27     public void onFailure(Throwable throwable) {
28         settableFuture.setException(throwable);
29     }
30 }