BUG-1075: ingress back pressure
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / queue / MessageSourcePollRegistration.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. 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.openflow.md.queue;
9
10
11 /**
12  * closable registration for {@link MessageSourcePollRegistrator}
13  * @param <IN> queue input message type
14  */
15 public class MessageSourcePollRegistration<IN> implements AutoCloseable {
16     
17     private MessageSourcePollRegistrator<IN> messageSourceRegistry;
18     private IN messageSource;
19     
20     /**
21      * @param messageSourceRegistry
22      * @param messageSource 
23      */
24     public MessageSourcePollRegistration(MessageSourcePollRegistrator<IN> messageSourceRegistry,
25             IN messageSource) {
26         this.messageSourceRegistry = messageSourceRegistry;
27         this.messageSource = messageSource;
28     }
29
30     @Override
31     public void close() throws Exception {
32         messageSourceRegistry.unregisterMessageSource(messageSource);
33     }
34 }