use of org.checkerframework.checker.lock.qual.Holding in project controller by opendaylight.
the class ProxyHistory method doSkipTransactions.
@Holding("lock")
private void doSkipTransactions(final List<TransactionIdentifier> toSkip) {
final var txIds = toSkip.stream().mapToLong(TransactionIdentifier::getTransactionId).distinct().sorted().mapToObj(UnsignedLong::fromLongBits).collect(ImmutableList.toImmutableList());
LOG.debug("Proxy {} skipping transactions {}", this, txIds);
connection.enqueueRequest(new SkipTransactionsRequest(new TransactionIdentifier(identifier, txIds.get(0).longValue()), 0, localActor(), txIds.subList(1, txIds.size())), resp -> {
LOG.debug("Proxy {} confirmed transaction skip", this);
}, connection.currentTime());
}
use of org.checkerframework.checker.lock.qual.Holding in project bgpcep by opendaylight.
the class BmpRouterImpl method tearDown.
@Holding("this")
@SuppressWarnings("checkstyle:IllegalCatch")
private synchronized void tearDown() {
// the session has been teared down before
if (this.session == null) {
return;
}
// we want to display remote router's IP here, as sometimes this.session.close() is already
// invoked before tearDown(), and session channel is null in this case, which leads to unuseful
// log information
LOG.info("BMP Session with remote router {} ({}) went down.", this.routerIp, this.session);
this.session = null;
final Iterator<BmpRouterPeer> it = this.peers.values().iterator();
try {
while (it.hasNext()) {
it.next().close();
it.remove();
}
this.domTxChain.close();
} catch (final Exception e) {
LOG.error("Failed to properly close BMP application.", e);
} finally {
// as the routerId is the same for both connection
if (isDatastoreWritable()) {
try {
// it means the session was closed before it was written to datastore
final DOMDataTreeWriteTransaction wTx = this.domDataBroker.newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.OPERATIONAL, this.routerYangIId);
wTx.commit().get();
} catch (final InterruptedException | ExecutionException e) {
LOG.error("Failed to remove BMP router data from DS.", e);
}
this.sessionManager.removeSessionListener(this);
}
}
}
use of org.checkerframework.checker.lock.qual.Holding in project bgpcep by opendaylight.
the class BGPPeer method handleGracefulEndOfRib.
@Holding("this")
private void handleGracefulEndOfRib() {
if (isLocalRestarting()) {
if (this.missingEOT.isEmpty()) {
createEffRibInWriter();
this.effRibInWriter.init();
registerPrefixesCounters(this.effRibInWriter, this.effRibInWriter);
for (final TablesKey key : getAfiSafisAdvertized()) {
createAdjRibOutListener(key, true);
}
setLocalRestartingState(false);
setGracefulPreferences(false, Collections.emptySet());
}
}
}
use of org.checkerframework.checker.lock.qual.Holding in project bgpcep by opendaylight.
the class BGPSessionImpl method notifyTerminationReasonAndCloseWithoutMessage.
@Holding({ "this.listener", "this" })
private void notifyTerminationReasonAndCloseWithoutMessage(final Uint8 errorCode, final Uint8 errorSubcode) {
this.terminationReasonNotified = true;
this.closeWithoutMessage();
this.listener.onSessionTerminated(this, new BGPTerminationReason(BGPError.forValue(errorCode, errorSubcode)));
}
use of org.checkerframework.checker.lock.qual.Holding in project bgpcep by opendaylight.
the class BGPSessionImpl method terminate.
/**
* Closes BGP session from the parent with given reason. A message needs to be sent, but parent doesn't have to be
* modified, because he initiated the closing. (To prevent concurrent modification exception).
*
* @param cause BGPDocumentedException
*/
@VisibleForTesting
@Holding({ "this.listener", "this" })
void terminate(final BGPDocumentedException cause) {
final BGPError error = cause.getError();
final byte[] data = cause.getData();
final NotifyBuilder builder = new NotifyBuilder().setErrorCode(error.getCode()).setErrorSubcode(error.getSubcode());
if (data != null && data.length != 0) {
builder.setData(data);
}
writeAndFlush(builder.build());
notifyTerminationReasonAndCloseWithoutMessage(error);
}
Aggregations