LOG.debug("Creating RIB instance with configuration: {}", global);
this.ribImpl = new RibImpl(ribExtensionContext, dispatcher, policyFactory, codecFactory, domBroker, dataBroker,
schemaService);
- initiateRibInstance(global, this.ribImpl);
+ initiateRibInstance(global);
LOG.debug("RIB instance created: {}", this.ribImpl);
}
LOG.debug("Modifying RIB instance with configuration: {}", global);
final List<PeerBean> closedPeers = closeAllBindedPeers();
closeRibService();
- initiateRibInstance(global, this.ribImpl);
+ initiateRibInstance(global);
for (final PeerBean peer : closedPeers) {
peer.restart(this.ribImpl, this.bgpIid, this.peerGroupLoader, this.tableTypeRegistry);
}
LOG.debug("RIB instance created: {}", this.ribImpl);
}
+ @SuppressWarnings("checkstyle:illegalCatch")
private void closeRibService() {
try {
this.ribImpl.closeServiceInstance().get(TIMEOUT_NS, TimeUnit.NANOSECONDS);
this.ribImpl.close();
}
- private synchronized void initiateRibInstance(final Global global, final RibImpl ribImpl) {
+ @GuardedBy("this")
+ private void initiateRibInstance(final Global global) {
final String ribInstanceName = getRibInstanceName(this.bgpIid);
ribImpl.start(global, ribInstanceName, this.tableTypeRegistry);
if (this.instantiated.get()) {
}
}
+ @SuppressWarnings("checkstyle:illegalCatch")
private synchronized List<PeerBean> closeAllBindedPeers() {
final List<PeerBean> filtered = new ArrayList<>();
this.peers.forEach((key, peer) -> {
LOG.debug("Peer instance updated {}", bgpPeer);
}
+ @SuppressWarnings("checkstyle:illegalCatch")
private static void closePeer(final PeerBean bgpPeer) {
if (bgpPeer != null) {
try {
final PeerBean bgpPeer = this.peers.remove(getNeighborInstanceIdentifier(this.bgpIid, neighbor.key()));
final Optional<String> groupName = getPeerGroupName(neighbor.getConfig());
- groupName.ifPresent(s -> this.peersGroups.computeIfPresent(s, (k, peers) -> {
- peers.remove(bgpPeer);
- return peers.isEmpty() ? null : peers;
+ groupName.ifPresent(s -> this.peersGroups.computeIfPresent(s, (k, groupPeers) -> {
+ groupPeers.remove(bgpPeer);
+ return groupPeers.isEmpty() ? null : groupPeers;
}));
closePeer(bgpPeer);
}
}
}
+ @SuppressWarnings("checkstyle:illegalCatch")
synchronized void restartNeighbors(final String peerGroupName) {
final List<PeerBean> peerGroup = this.peersGroups.get(peerGroupName);
if (peerGroup == null) {