Bump MRI upstreams
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / core / connection / UdpMessageListenerWrapper.java
1 /*
2  * Copyright (c) 2014 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
9 package org.opendaylight.openflowjava.protocol.impl.core.connection;
10
11 import io.netty.util.concurrent.Future;
12 import io.netty.util.concurrent.GenericFutureListener;
13 import java.net.InetSocketAddress;
14
15 /**
16  * Wraps outgoing message and includes listener attached to this message. This object
17  * is sent to OFEncoder. When OFEncoder fails to serialize the message,
18  * listener is filled with exception. The exception is then delegated to upper ODL layers.
19  * This object is used for UDP communication - it also carries recipient address
20
21  * @author michal.polkorab
22  */
23 public class UdpMessageListenerWrapper extends MessageListenerWrapper {
24
25     private final InetSocketAddress address;
26
27     /**
28      * Constructor.
29      *
30      * @param msg message to be sent
31      * @param listener listener attached to channel.write(msg) Future
32      * @param address recipient's address
33      */
34     public UdpMessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener,
35             InetSocketAddress address) {
36         super(msg, listener);
37         this.address = address;
38     }
39
40     /**
41      * Returns recipient address.
42      */
43     public InetSocketAddress getAddress() {
44         return address;
45     }
46 }