BUG-3219: Introduce OutboundQueueHandler and related interfaces
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / connection / OutboundQueueHandler.java
1 /*
2  * Copyright (c) 2015 Pantheon Technologies s.r.o. 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.openflowjava.protocol.api.connection;
9
10 import com.google.common.annotations.Beta;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
13
14 /**
15  * Handler of the outbound queue. The queue has a maximum depth assigned when the
16  * handler is registered.
17  */
18 @Beta
19 public interface OutboundQueueHandler {
20     /**
21      * Create a new {@link BarrierInput barrier} message. This callback is invoked
22      * when the queue is being flushed to the switch. The barrier ensures that any
23      * outstanding requests are detected as either completed or failed.
24      *
25      * @param xid XID for the barrier message
26      * @return New barrier message.
27      */
28     @Nonnull BarrierInput createBarrierRequest(@Nonnull Long xid);
29
30     /**
31      * Invoked whenever the underlying queue is refreshed. Implementations should
32      * ensure they are talking to the latest queue
33      * @param queue New queue instance, null indicates a shutdown, e.g. the queue
34      *              is no longer available.
35      */
36     void onConnectionQueueChanged(OutboundQueue queue);
37 }