Search in sources :

Example 6 with FluentFuture

use of com.google.common.util.concurrent.FluentFuture 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();
}
Also used : DOMDataTreeWriteTransaction(org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction) MonitoredRouter(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev200120.odl.bmp.monitors.bmp.monitor.config.MonitoredRouter) BindingCodecTree(org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree) BmpMonitor(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.BmpMonitor) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) ClusterSingletonService(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService) Rfc2385Key(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key) Monitor(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.bmp.monitor.Monitor) InetAddress(java.net.InetAddress) ClusterSingletonServiceRegistration(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration) ServiceGroupIdentifier(org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier) IetfInetUtil(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil) Objects.requireNonNull(java.util.Objects.requireNonNull) ChannelFutureListener(io.netty.channel.ChannelFutureListener) Map(java.util.Map) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) CommitInfo(org.opendaylight.mdsal.common.api.CommitInfo) ClusterSingletonServiceProvider(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider) MonitorId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.MonitorId) Logger(org.slf4j.Logger) Collection(java.util.Collection) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) InetSocketAddress(java.net.InetSocketAddress) QName(org.opendaylight.yangtools.yang.common.QName) ChannelFuture(io.netty.channel.ChannelFuture) Channel(io.netty.channel.Channel) ExecutionException(java.util.concurrent.ExecutionException) Ipv4Util(org.opendaylight.protocol.util.Ipv4Util) BmpMonitoringStation(org.opendaylight.protocol.bmp.impl.spi.BmpMonitoringStation) DOMDataBroker(org.opendaylight.mdsal.dom.api.DOMDataBroker) BmpDispatcher(org.opendaylight.protocol.bmp.api.BmpDispatcher) ImmutableNodes(org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) Preconditions(com.google.common.base.Preconditions) InetAddresses(com.google.common.net.InetAddresses) RIBExtensionConsumerContext(org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext) Router(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.routers.Router) FluentFuture(com.google.common.util.concurrent.FluentFuture) DOMDataTreeWriteTransaction(org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction)

Aggregations

FluentFuture (com.google.common.util.concurrent.FluentFuture)6 ExecutionException (java.util.concurrent.ExecutionException)6 FutureCallback (com.google.common.util.concurrent.FutureCallback)3 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)3 ArrayList (java.util.ArrayList)3 Collection (java.util.Collection)3 List (java.util.List)3 Objects (java.util.Objects)3 Optional (java.util.Optional)3 PreDestroy (javax.annotation.PreDestroy)3 Inject (javax.inject.Inject)3 Singleton (javax.inject.Singleton)3 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 AddressFromURIString (akka.actor.AddressFromURIString)2 Lists (com.google.common.collect.Lists)2 Futures (com.google.common.util.concurrent.Futures)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 HashMap (java.util.HashMap)2