2 * Copyright (c) 2013 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
8 package org.opendaylight.protocol.framework;
10 import java.util.ArrayList;
11 import java.util.List;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
17 * Simple Session Listener that is notified about messages and changes in the session.
19 public class SimpleSessionListener implements SessionListener<SimpleMessage, SimpleSession, TerminationReason> {
20 private static final Logger LOG = LoggerFactory.getLogger(SimpleSessionListener.class);
22 public List<SimpleMessage> messages = new ArrayList<>();
24 public boolean up = false;
26 public boolean failed = false;
29 public void onMessage(final SimpleSession session, final SimpleMessage message) {
30 LOG.debug("Received message: " + message.getClass() + " " + message);
31 this.messages.add(message);
35 public void onSessionUp(final SimpleSession session) {
40 public void onSessionDown(final SimpleSession session, final Exception e) {
46 public void onSessionTerminated(final SimpleSession session, final TerminationReason reason) {