2 * Copyright (c) 2015 Cisco Systems, Inc. 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.impl.rpc;
10 import com.google.common.util.concurrent.SettableFuture;
11 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
12 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
13 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
14 import org.opendaylight.yangtools.yang.common.RpcResult;
19 public class RequestContextImpl<T> implements RequestContext<T> {
21 private final RequestContextStack requestContextStack;
22 private SettableFuture<RpcResult<T>> rpcResultFuture;
23 private long waitTimeout;
26 public RequestContextImpl(RequestContextStack requestContextStack) {
27 this.requestContextStack = requestContextStack;
32 requestContextStack.forgetRequestContext(this);
36 public SettableFuture<RpcResult<T>> getFuture() {
37 if (null == rpcResultFuture) {
38 rpcResultFuture = SettableFuture.create();
40 return rpcResultFuture;
49 public void setXid(Xid xid) {
54 public long getWaitTimeout() {
59 public void setWaitTimeout(long waitTimeout) {
60 this.waitTimeout = waitTimeout;