/**
* Listener for the client.
*/
-public class SimpleSessionListener implements BGPSessionListener {
-
- private final List<Notification> listMsg = Lists.newArrayList();
-
- public boolean up = false;
+public final class SimpleSessionListener implements BGPSessionListener {
private static final Logger LOG = LoggerFactory.getLogger(SimpleSessionListener.class);
-
- public boolean down = false;
-
+ private final List<Notification> listMsg = Lists.newArrayList();
private BGPSession session;
- public SimpleSessionListener() {
+ SimpleSessionListener() {
}
- public List<Notification> getListMsg() {
+ List<Notification> getListMsg() {
return this.listMsg;
}
@Override
- public void onMessage(final BGPSession session, final Notification message) {
- this.listMsg.add(message);
- LOG.debug("Message received: {}", message);
+ public boolean isSessionActive() {
+ return ((BGPSessionImpl) this.session).isWritable();
+ }
+
+ @Override
+ public void markUptodate(final TablesKey tablesKey) {
+ LOG.debug("Table marked as up-to-date {}", tablesKey);
}
@Override
public void onSessionUp(final BGPSession session) {
LOG.debug("Session Up");
this.session = session;
- this.up = true;
}
@Override
public void onSessionDown(final BGPSession session, final Exception e) {
LOG.debug("Session Down", e);
- this.down = true;
}
@Override
LOG.debug("Session terminated. Cause : {}", cause.toString());
}
+ @Override
+ public void onMessage(final BGPSession session, final Notification message) {
+ this.listMsg.add(message);
+ LOG.debug("Message received: {}", message);
+ }
+
@Override
public void releaseConnection() {
LOG.debug("Releasing connection");
} catch (final Exception e) {
LOG.warn("Error closing session", e);
}
- this.session = null;
}
}
- @Override
- public boolean isSessionActive() {
- return true;
- }
-
- @Override
- public void markUptodate(final TablesKey tablesKey) {
- LOG.debug("Table marked as up-to-date {}", tablesKey);
+ BGPSessionImpl.State getState() {
+ return ((BGPSessionImpl) this.session).getState();
}
}