External api proposal
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / PopListenerCountingImpl.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.core;
9
10 import org.opendaylight.openflowplugin.api.openflow.md.queue.PopListener;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13
14 /**
15  * @author mirehak
16  * @param <T> resulting type
17  *
18  */
19 public class PopListenerCountingImpl<T> implements PopListener<T> {
20
21     private static final Logger LOG = LoggerFactory
22             .getLogger(PopListenerCountingImpl.class);
23     private int count = 0;
24
25     @Override
26     public synchronized void onPop(T processedMessage) {
27         LOG.debug("message popped: {}", processedMessage);
28         count += 1;
29         notify();
30     }
31     
32     /**
33      * @return the count
34      */
35     public int getCount() {
36         return count;
37     }
38
39 }