Use QueuedNotificationManager to dispatch tasks
[openflowplugin.git] / applications / forwardingrules-manager / src / main / java / org / opendaylight / openflowplugin / applications / frm / NodeConfigurator.java
1 /*
2  * Copyright (c) 2018 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.openflowplugin.applications.frm;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11
12 import java.util.concurrent.Callable;
13
14 public interface NodeConfigurator extends AutoCloseable {
15
16     /**
17      * Enqueues a job in nodeconfigurator.
18      *
19      * @param key        The job's key. Jobs with the same key are run sequentially.
20      *                   Jobs with different keys are run in parallel.
21      * @param mainWorker The task that runs for the job.
22      *
23      * @return the result of the enqueued job.
24      */
25     <T> ListenableFuture<T> enqueueJob(String key, Callable<ListenableFuture<T>> mainWorker);
26 }