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.
21 private final String key;
22 private volatile @Nullable Callable<ListenableFuture<T>> mainWorker;
23 private volatile SettableFuture<T> resultFuture;
25 JobEntry(String key, Callable<ListenableFuture<T>> mainWorker) {
27 this.mainWorker = mainWorker;
28 resultFuture = SettableFuture.create();
31 public String getKey() {
35 @Nullable public Callable<ListenableFuture<T>> getMainWorker() {
39 public void setMainWorker(@Nullable Callable<ListenableFuture<T>> mainWorker) {
40 this.mainWorker = mainWorker;
43 public ListenableFuture<T> getResultFuture() {
47 public void setResultFuture(@Nullable T result) {
48 this.resultFuture.set(result);