2 * Copyright (c) 2018 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
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
8 package org.opendaylight.openflowplugin.applications.frm.nodeconfigurator;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import com.google.common.util.concurrent.SettableFuture;
12 import java.util.concurrent.Callable;
13 import javax.annotation.Nullable;
16 * JobEntry is the entity built per job submitted by the application and
17 * enqueued to the book-keeping data structure.
20 private final SettableFuture<T> resultFuture = SettableFuture.create();
21 private @Nullable final Callable<ListenableFuture<T>> mainWorker;
22 private final String key;
24 JobEntry(String key, Callable<ListenableFuture<T>> mainWorker) {
26 this.mainWorker = mainWorker;
33 @Nullable Callable<ListenableFuture<T>> getMainWorker() {
37 ListenableFuture<T> getResultFuture() {
41 void setResult(@Nullable T result) {
42 resultFuture.set(result);
45 void setFailure(Throwable failure) {
46 resultFuture.setException(failure);