Proxy over MDSAL-provided IMDS 39/71439/5
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 26 Apr 2018 16:56:57 +0000 (18:56 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 10 Jul 2018 17:35:12 +0000 (19:35 +0200)
This patch migrates Controller IMDS to be just a proxy over the
MDSAL's IMDS implementation.

Change-Id: I8e54ec344d010a91e06ef2f1fb63586de3b26949
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-inmemory-datastore/pom.xml
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ChainedTransactionCommitImpl.java [deleted file]
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/DOMStoreTransactionChainImpl.java [deleted file]
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreConfigProperties.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreFactory.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreThreePhaseCommitCohort.java [deleted file]
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/jmx/InMemoryDataStoreStats.java

index a1c37f8..3c76916 100644 (file)
       <artifactId>yang-data-impl</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>org.opendaylight.mdsal</groupId>
+      <artifactId>mdsal-dom-inmemory-datastore</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ChainedTransactionCommitImpl.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ChainedTransactionCommitImpl.java
deleted file mode 100644 (file)
index 89ca972..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.dom.store.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-
-final class ChainedTransactionCommitImpl extends InMemoryDOMStoreThreePhaseCommitCohort {
-    private final DOMStoreTransactionChainImpl txChain;
-
-    ChainedTransactionCommitImpl(final InMemoryDOMDataStore store,
-                                 final SnapshotBackedWriteTransaction<String> transaction,
-                                 final DataTreeModification modification,
-                                 final DOMStoreTransactionChainImpl txChain,
-                                 final Exception operationError) {
-        super(store, transaction, modification, operationError);
-        this.txChain = Preconditions.checkNotNull(txChain);
-    }
-
-    @Override
-    public ListenableFuture<Void> commit() {
-        ListenableFuture<Void> ret = super.commit();
-        txChain.transactionCommited(getTransaction());
-        return ret;
-    }
-
-}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/DOMStoreTransactionChainImpl.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/DOMStoreTransactionChainImpl.java
deleted file mode 100644 (file)
index 84c9c46..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.dom.store.impl;
-
-import com.google.common.base.Preconditions;
-import org.opendaylight.controller.sal.core.spi.data.AbstractSnapshotBackedTransactionChain;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
-
-final class DOMStoreTransactionChainImpl extends AbstractSnapshotBackedTransactionChain<String> {
-    private final InMemoryDOMDataStore store;
-
-    DOMStoreTransactionChainImpl(final InMemoryDOMDataStore store) {
-        this.store = Preconditions.checkNotNull(store);
-    }
-
-    @Override
-    protected DOMStoreThreePhaseCommitCohort createCohort(final SnapshotBackedWriteTransaction<String> tx,
-                                                          final DataTreeModification modification,
-                                                          final Exception operationError) {
-        return new ChainedTransactionCommitImpl(store, tx, modification, this, operationError);
-    }
-
-    @Override
-    protected DataTreeSnapshot takeSnapshot() {
-        return store.takeSnapshot();
-    }
-
-    @Override
-    protected String nextTransactionIdentifier() {
-        return store.nextIdentifier();
-    }
-
-    @Override
-    protected boolean getDebugTransactions() {
-        return store.getDebugTransactions();
-    }
-
-    void transactionCommited(final SnapshotBackedWriteTransaction<String> transaction) {
-        super.onTransactionCommited(transaction);
-    }
-}
index 9bee079..a756676 100644 (file)
@@ -7,62 +7,25 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import com.google.common.base.Preconditions;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
-import org.opendaylight.controller.sal.core.spi.data.DOMStore;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTreeChangePublisher;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedTransactions;
-import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransaction.TransactionReadyPrototype;
+import org.opendaylight.controller.sal.core.compat.DOMStoreAdapter;
 import org.opendaylight.yangtools.concepts.Identifiable;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.util.ExecutorServiceUtil;
 import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
- * In-memory DOM Data Store
- *
- * <p>
- * Implementation of {@link DOMStore} which uses {@link DataTree} and other
- * classes such as {@link SnapshotBackedWriteTransaction}.
- * {@link org.opendaylight.controller.sal.core.spi.data.SnapshotBackedReadTransaction} and
- * to implement {@link DOMStore} contract.
+ * In-memory DOM Data Store providing Controller MD-SAL APIs on top of MD-SAL's
+ * {@link org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore}.
  *
+ * @deprecated Please use {@link org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore} instead.
  */
-public class InMemoryDOMDataStore extends TransactionReadyPrototype<String>
-        implements DOMStore, Identifiable<String>, SchemaContextListener, AutoCloseable, DOMStoreTreeChangePublisher {
-    private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMDataStore.class);
-
-    private final DataTree dataTree;
-    private final AtomicLong txCounter = new AtomicLong(0);
-
-    private final InMemoryDOMStoreTreeChangePublisher changePublisher;
-    private final ExecutorService dataChangeListenerExecutor;
-    private final boolean debugTransactions;
-    private final String name;
-
-    private volatile AutoCloseable closeable;
+@Deprecated
+public class InMemoryDOMDataStore
+        extends DOMStoreAdapter<org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore>
+        implements Identifiable<String>, SchemaContextListener, AutoCloseable {
+    private final org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore delegate;
 
     public InMemoryDOMDataStore(final String name, final ExecutorService dataChangeListenerExecutor) {
         this(name, LogicalDatastoreType.OPERATIONAL, dataChangeListenerExecutor,
@@ -72,125 +35,39 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype<String>
     public InMemoryDOMDataStore(final String name, final LogicalDatastoreType type,
             final ExecutorService dataChangeListenerExecutor,
             final int maxDataChangeListenerQueueSize, final boolean debugTransactions) {
-        this.name = Preconditions.checkNotNull(name);
-        this.dataChangeListenerExecutor = Preconditions.checkNotNull(dataChangeListenerExecutor);
-        this.debugTransactions = debugTransactions;
-
-        changePublisher = new InMemoryDOMStoreTreeChangePublisher(this.dataChangeListenerExecutor,
-                maxDataChangeListenerQueueSize);
+        delegate = new org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore(name, dataChangeListenerExecutor,
+            maxDataChangeListenerQueueSize, debugTransactions);
+    }
 
-        switch (type) {
-            case CONFIGURATION:
-                dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_CONFIGURATION);
-                break;
-            case OPERATIONAL:
-                dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL);
-                break;
-            default:
-                throw new IllegalArgumentException("Data store " + type + " not supported");
-        }
+    @Override
+    protected org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore delegate() {
+        return delegate;
     }
 
     public void setCloseable(final AutoCloseable closeable) {
-        this.closeable = closeable;
+        delegate.setCloseable(closeable);
     }
 
     public QueuedNotificationManager<?, ?> getDataChangeListenerNotificationManager() {
-        return changePublisher.getNotificationManager();
+        return delegate.getDataChangeListenerNotificationManager();
     }
 
     @Override
     public final String getIdentifier() {
-        return name;
-    }
-
-    @Override
-    public DOMStoreReadTransaction newReadOnlyTransaction() {
-        return SnapshotBackedTransactions.newReadTransaction(nextIdentifier(), debugTransactions,
-                dataTree.takeSnapshot());
+        return delegate.getIdentifier();
     }
 
     @Override
-    public DOMStoreReadWriteTransaction newReadWriteTransaction() {
-        return SnapshotBackedTransactions.newReadWriteTransaction(nextIdentifier(), debugTransactions,
-                dataTree.takeSnapshot(), this);
+    public void onGlobalContextUpdated(final SchemaContext ctx) {
+        delegate.onGlobalContextUpdated(ctx);
     }
 
     @Override
-    public DOMStoreWriteTransaction newWriteOnlyTransaction() {
-        return SnapshotBackedTransactions.newWriteTransaction(nextIdentifier(), debugTransactions,
-                dataTree.takeSnapshot(), this);
-    }
-
-    @Override
-    public DOMStoreTransactionChain createTransactionChain() {
-        return new DOMStoreTransactionChainImpl(this);
-    }
-
-    @Override
-    public synchronized void onGlobalContextUpdated(final SchemaContext ctx) {
-        dataTree.setSchemaContext(ctx);
-    }
-
-    @Override
-    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
-        ExecutorServiceUtil.tryGracefulShutdown(dataChangeListenerExecutor, 30, TimeUnit.SECONDS);
-
-        if (closeable != null) {
-            try {
-                closeable.close();
-            } catch (Exception e) {
-                LOG.debug("Error closing instance", e);
-            }
-        }
+        delegate.close();
     }
 
     public final boolean getDebugTransactions() {
-        return debugTransactions;
-    }
-
-    final DataTreeSnapshot takeSnapshot() {
-        return dataTree.takeSnapshot();
-    }
-
-    @Override
-    public synchronized <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
-            final YangInstanceIdentifier treeId, final L listener) {
-        /*
-         * Make sure commit is not occurring right now. Listener has to be
-         * registered and its state capture enqueued at a consistent point.
-         */
-        return changePublisher.registerTreeChangeListener(treeId, listener, dataTree.takeSnapshot());
-    }
-
-    @Override
-    protected void transactionAborted(final SnapshotBackedWriteTransaction<String> tx) {
-        LOG.debug("Tx: {} is closed.", tx.getIdentifier());
-    }
-
-    @Override
-    protected DOMStoreThreePhaseCommitCohort transactionReady(final SnapshotBackedWriteTransaction<String> tx,
-                                                              final DataTreeModification modification,
-                                                              final Exception readyError) {
-        LOG.debug("Tx: {} is submitted. Modifications: {}", tx.getIdentifier(), modification);
-        return new InMemoryDOMStoreThreePhaseCommitCohort(this, tx, modification, readyError);
-    }
-
-    String nextIdentifier() {
-        return name + "-" + txCounter.getAndIncrement();
-    }
-
-    void validate(final DataTreeModification modification) throws DataValidationFailedException {
-        dataTree.validate(modification);
-    }
-
-    DataTreeCandidate prepare(final DataTreeModification modification) {
-        return dataTree.prepare(modification);
-    }
-
-    synchronized void commit(final DataTreeCandidate candidate) {
-        dataTree.commit(candidate);
-        changePublisher.publishChange(candidate);
+        return delegate.getDebugTransactions();
     }
 }
index 20e4f40..7266fb7 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 /**
@@ -14,7 +13,10 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
  *
  * @author Thomas Pantelis
  * @see InMemoryDOMDataStoreFactory
+ *
+ * @deprecated Use {@link org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStoreConfigProperties} instead.
  */
+@Deprecated
 public final class InMemoryDOMDataStoreConfigProperties {
 
     public static final int DEFAULT_MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE = 1000;
index f5c5c4a..7d98e0d 100644 (file)
@@ -17,7 +17,10 @@ import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
  * A factory for creating InMemoryDOMDataStore instances.
  *
  * @author Thomas Pantelis
+ *
+ * @deprecated Use {@link org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStoreFactory} instead.
  */
+@Deprecated
 public final class InMemoryDOMDataStoreFactory {
 
     private InMemoryDOMDataStoreFactory() {
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreThreePhaseCommitCohort.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreThreePhaseCommitCohort.java
deleted file mode 100644 (file)
index c248541..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.md.sal.dom.store.impl;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.sal.core.spi.data.AbstractDOMStoreTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ConflictingModificationAppliedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressFBWarnings(value = "NP_NONNULL_PARAM_VIOLATION", justification = "Void is the only allowed value")
-class InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort {
-    private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMStoreThreePhaseCommitCohort.class);
-    private static final ListenableFuture<Void> SUCCESSFUL_FUTURE = Futures.immediateFuture(null);
-    private static final ListenableFuture<Boolean> CAN_COMMIT_FUTURE = Futures.immediateFuture(Boolean.TRUE);
-    private final SnapshotBackedWriteTransaction<String> transaction;
-    private final DataTreeModification modification;
-    private final InMemoryDOMDataStore store;
-    private DataTreeCandidate candidate;
-    private final Exception operationError;
-
-    InMemoryDOMStoreThreePhaseCommitCohort(final InMemoryDOMDataStore store,
-            final SnapshotBackedWriteTransaction<String> writeTransaction, final DataTreeModification modification,
-            final Exception operationError) {
-        this.transaction = Preconditions.checkNotNull(writeTransaction);
-        this.modification = Preconditions.checkNotNull(modification);
-        this.store = Preconditions.checkNotNull(store);
-        this.operationError = operationError;
-    }
-
-    private static void warnDebugContext(final AbstractDOMStoreTransaction<?> transaction) {
-        final Throwable ctx = transaction.getDebugContext();
-        if (ctx != null) {
-            LOG.warn("Transaction {} has been allocated in the following context", transaction.getIdentifier(), ctx);
-        }
-    }
-
-    @Override
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    public final ListenableFuture<Boolean> canCommit() {
-        if (operationError != null) {
-            return Futures.immediateFailedFuture(operationError);
-        }
-
-        try {
-            store.validate(modification);
-            LOG.debug("Store Transaction: {} can be committed", getTransaction().getIdentifier());
-            return CAN_COMMIT_FUTURE;
-        } catch (ConflictingModificationAppliedException e) {
-            LOG.warn("Store Tx: {} Conflicting modification for {}.", getTransaction().getIdentifier(),
-                    e.getPath());
-            warnDebugContext(getTransaction());
-            return Futures.immediateFailedFuture(new OptimisticLockFailedException("Optimistic lock failed.", e));
-        } catch (DataValidationFailedException e) {
-            LOG.warn("Store Tx: {} Data Precondition failed for {}.", getTransaction().getIdentifier(),
-                    e.getPath(), e);
-            warnDebugContext(getTransaction());
-
-            // For debugging purposes, allow dumping of the modification. Coupled with the above
-            // precondition log, it should allow us to understand what went on.
-            LOG.trace("Store Tx: {} modifications: {} tree: {}", modification, store);
-
-            return Futures.immediateFailedFuture(new TransactionCommitFailedException(
-                    "Data did not pass validation.", e));
-        } catch (RuntimeException e) {
-            LOG.warn("Unexpected failure in validation phase", e);
-            return Futures.immediateFailedFuture(e);
-        }
-    }
-
-    @Override
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    public final ListenableFuture<Void> preCommit() {
-        try {
-            candidate = store.prepare(modification);
-            return SUCCESSFUL_FUTURE;
-        } catch (RuntimeException e) {
-            LOG.warn("Unexpected failure in pre-commit phase", e);
-            return Futures.immediateFailedFuture(e);
-        }
-    }
-
-    @Override
-    public final ListenableFuture<Void> abort() {
-        candidate = null;
-        return SUCCESSFUL_FUTURE;
-    }
-
-    protected final SnapshotBackedWriteTransaction<String> getTransaction() {
-        return transaction;
-    }
-
-    @Override
-    public ListenableFuture<Void> commit() {
-        checkState(candidate != null, "Proposed subtree must be computed");
-
-        /*
-         * The commit has to occur atomically with regard to listener
-         * registrations.
-         */
-        store.commit(candidate);
-        return SUCCESSFUL_FUTURE;
-    }
-}
-
index f4af794..7c80fd0 100644 (file)
@@ -5,13 +5,13 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.md.sal.dom.store.impl.jmx;
 
 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
 import org.opendaylight.controller.md.sal.common.util.jmx.QueuedNotificationManagerMXBeanImpl;
 import org.opendaylight.controller.md.sal.common.util.jmx.ThreadExecutorStatsMXBeanImpl;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
+import org.opendaylight.yangtools.concepts.AbstractRegistration;
 import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager;
 
 /**
@@ -19,7 +19,7 @@ import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager;
  *
  * @author Thomas Pantelis
  */
-public class InMemoryDataStoreStats implements AutoCloseable {
+public class InMemoryDataStoreStats extends AbstractRegistration {
 
     private final AbstractMXBean notificationExecutorStatsBean;
     private final QueuedNotificationManagerMXBeanImpl notificationManagerStatsBean;
@@ -42,7 +42,7 @@ public class InMemoryDataStoreStats implements AutoCloseable {
     }
 
     @Override
-    public void close() throws Exception {
+    protected void removeRegistration() {
         if (notificationExecutorStatsBean != null) {
             notificationExecutorStatsBean.unregisterMBean();
         }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.