+ protected RIB getRib() {
+ return this.rib;
+ }
+
+ @Override
+ public void releaseConnection() {
+ dropConnection();
+ cleanup();
+ }
+
+ @GuardedBy("this")
+ private void dropConnection() {
+ if (this.runtimeReg != null) {
+ this.runtimeReg.close();
+ this.runtimeReg = null;
+ }
+ if (this.session != null) {
+ this.session.close();
+ this.session = null;
+ }
+ }
+
+ @Override
+ public boolean isSessionActive() {
+ return this.session != null;
+ }
+
+ @Override
+ public synchronized byte[] getRawIdentifier() {
+ return Arrays.copyOf(this.rawIdentifier, this.rawIdentifier.length);
+ }
+
+ @Override
+ public void resetSession() {
+ releaseConnection();
+ }
+
+ @Override
+ public void resetStats() {
+ if (this.session instanceof BGPSessionStatistics) {
+ ((BGPSessionStatistics) this.session).resetSessionStats();
+ }
+ }
+
+ public synchronized void registerRootRuntimeBean(final BGPPeerRuntimeRegistrator registrator) {
+ this.registrator = registrator;
+ }
+
+ @Override
+ public BgpSessionState getBgpSessionState() {
+ if (this.session instanceof BGPSessionStatistics) {
+ return ((BGPSessionStatistics) this.session).getBgpSesionState();
+ }
+ return new BgpSessionState();
+ }
+
+ @Override
+ public synchronized BgpPeerState getBgpPeerState() {
+ final BgpPeerState peerState = new BgpPeerState();
+ final List<RouteTable> routes = Lists.newArrayList();
+ for (final TablesKey tablesKey : this.tables) {
+ final RouteTable routeTable = new RouteTable();
+ routeTable.setTableType("afi=" + tablesKey.getAfi().getSimpleName() + ",safi=" + tablesKey.getSafi().getSimpleName());
+ routeTable.setRoutesCount(this.rib.getRoutesCount(tablesKey));
+ routes.add(routeTable);
+ }
+ peerState.setRouteTable(routes);
+ peerState.setSessionEstablishedCount(this.sessionEstablishedCounter);
+ return peerState;
+ }
+
+ @Override
+ public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction, final Throwable cause) {
+ // TODO Auto-generated method stub
+
+ }
+