use of org.opendaylight.mdsal.common.api.CommitInfo in project controller by opendaylight.
the class OpendaylightToaster method close.
/**
* Implemented from the AutoCloseable interface.
*/
@Override
public void close() {
LOG.info("Closing...");
// Unregister our MXBean.
unregister();
// When we close this service we need to shutdown our executor!
executor.shutdown();
if (dataTreeChangeListenerRegistration != null) {
dataTreeChangeListenerRegistration.close();
}
if (dataBroker != null) {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.delete(OPERATIONAL, TOASTER_IID);
Futures.addCallback(tx.commit(), new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.debug("Successfully deleted the operational Toaster");
}
@Override
public void onFailure(final Throwable failure) {
LOG.error("Delete of the operational Toaster failed", failure);
}
}, MoreExecutors.directExecutor());
}
}
use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class BmpRibInWriter method removeRoutes.
private synchronized void removeRoutes(final MpUnreachNlri nlri) {
final TablesKey key = new TablesKey(nlri.getAfi(), nlri.getSafi());
final TableContext ctx = this.tables.get(key);
if (ctx == null) {
LOG.debug("No table for {}, not accepting NLRI {}", key, nlri);
return;
}
LOG.trace("Removing routes {}", nlri);
final DOMDataTreeWriteTransaction tx = this.chain.newWriteOnlyTransaction();
ctx.removeRoutes(tx, nlri);
tx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.trace("Successful commit");
}
@Override
public void onFailure(final Throwable trw) {
LOG.error("Failed commit", trw);
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class BmpRouterPeerImpl method onPeerDown.
private synchronized void onPeerDown() {
final DOMDataTreeWriteTransaction wTx = this.domTxChain.newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.OPERATIONAL, this.peerYangIId);
wTx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.trace("Successful commit");
}
@Override
public void onFailure(final Throwable trw) {
LOG.error("Failed commit", trw);
}
}, MoreExecutors.directExecutor());
close();
}
use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class BmpMonitoringStationImpl method closeServiceInstance.
@Override
public synchronized FluentFuture<? extends CommitInfo> closeServiceInstance() {
LOG.info("BMP Monitor Singleton Service {} instance closed, Monitor Id {}", getIdentifier().getName(), monitorId.getValue());
if (channel != null) {
channel.close().addListener((ChannelFutureListener) future -> {
Preconditions.checkArgument(future.isSuccess(), "Channel failed to close: %s", future.cause());
BmpMonitoringStationImpl.this.sessionManager.close();
});
}
final DOMDataTreeWriteTransaction wTx = domDataBroker.newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.OPERATIONAL, yangMonitorId);
LOG.info("BMP monitoring station {} closed.", monitorId.getValue());
return wTx.commit();
}
use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class BmpRouterImpl method onInitiate.
private synchronized void onInitiate(final InitiationMessage initiation) {
Preconditions.checkState(isDatastoreWritable());
final DOMDataTreeWriteTransaction wTx = this.domTxChain.newWriteOnlyTransaction();
wTx.merge(LogicalDatastoreType.OPERATIONAL, this.routerYangIId, Builders.mapEntryBuilder().withNodeIdentifier(NodeIdentifierWithPredicates.of(Router.QNAME, ROUTER_ID_QNAME, this.routerIp)).withChild(ImmutableNodes.leafNode(ROUTER_NAME_QNAME, initiation.getTlvs().getNameTlv().getName())).withChild(ImmutableNodes.leafNode(ROUTER_DESCRIPTION_QNAME, initiation.getTlvs().getDescriptionTlv().getDescription())).withChild(ImmutableNodes.leafNode(ROUTER_INFO_QNAME, getStringInfo(initiation.getTlvs().getStringInformation()))).withChild(ImmutableNodes.leafNode(ROUTER_STATUS_QNAME, UP)).build());
wTx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.trace("Successful commit");
}
@Override
public void onFailure(final Throwable trw) {
LOG.error("Failed commit", trw);
}
}, MoreExecutors.directExecutor());
}
Aggregations