56d004bdc51e13693a5888ad757ca3af4b1060db
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / core / connection / UdpMessageListenerWrapper.java
1 /*\r
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
10 \r
11 import io.netty.util.concurrent.Future;\r
12 import io.netty.util.concurrent.GenericFutureListener;\r
13 \r
14 import java.net.InetSocketAddress;\r
15 \r
16 /**\r
17  * Wraps outgoing message and includes listener attached to this message. This object\r
18  * is sent to OFEncoder. When OFEncoder fails to serialize the message,\r
19  * listener is filled with exception. The exception is then delegated to upper ODL layers.\r
20  * This object is used for UDP communication - it also carries recipient address\r
21  \r
22  * @author michal.polkorab\r
23  */\r
24 public class UdpMessageListenerWrapper extends MessageListenerWrapper {\r
25 \r
26     private InetSocketAddress address;\r
27 \r
28     /**\r
29      * @param msg message to be sent\r
30      * @param listener listener attached to channel.write(msg) Future\r
31      * @param address recipient's address\r
32      */\r
33     public UdpMessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener,\r
34             InetSocketAddress address) {\r
35         super(msg, listener);\r
36         this.address = address;\r
37     }\r
38 \r
39     /**\r
40      * @return recipient address\r
41      */\r
42     public InetSocketAddress getAddress() {\r
43         return address;\r
44     }\r
45 }