2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.openflowplugin.api.openflow.md.queue;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 public class WaterMarkListenerImpl implements WaterMarkListener {
18 private static final Logger LOG = LoggerFactory
19 .getLogger(WaterMarkListenerImpl.class);
21 private ConnectionAdapter connectionAdapter;
23 public WaterMarkListenerImpl(ConnectionAdapter connectionAdapter) {
24 this.connectionAdapter = Preconditions.checkNotNull(connectionAdapter);
30 * @see org.opendaylight.openflowplugin.api.openflow.md.queue.QueueListener#
32 * (org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter)
35 public void onHighWaterMark() {
36 connectionAdapter.setAutoRead(false);
37 LOG.debug("AutoRead is set on false: {}", connectionAdapter.getRemoteAddress());
43 * @see org.opendaylight.openflowplugin.api.openflow.md.queue.QueueListener#
45 * (org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter)
48 public void onLowWaterMark() {
49 connectionAdapter.setAutoRead(true);
50 LOG.debug("AutoRead is set on true: {}", connectionAdapter.getRemoteAddress());