Added transactions statistics support.
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / impl / DataBrokerImpl.java
index 2f4510d5b4f035e98e9351bcba8775a126f1f8a1..02c59b2779ccd511975bd4fa8109b1e2700e6d0d 100644 (file)
-package org.opendaylight.controller.sal.binding.impl;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataReader;
-import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;
-import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderRouter;
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;
-import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.DataRoot;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-
-public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> implements
-        DataProviderService, AutoCloseable {
-
-    
-    
-    private final AtomicLong nextTransaction = new AtomicLong();
-    
-    public DataBrokerImpl() {
-        setDataReadRouter(new BindingAwareDataReaderRouter());
-    }
-
-    @Override
-    public DataTransactionImpl beginTransaction() {
-        String transactionId = "BA-" + nextTransaction.getAndIncrement();
-        return new DataTransactionImpl(transactionId,this);
-    }
-
-    @Override
-    @Deprecated
-    public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public DataObject getData(InstanceIdentifier<? extends DataObject> data) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public DataObject getConfigurationData(InstanceIdentifier<?> data) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-
-    @Override
-    @Deprecated
-    public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path,
-            DataChangeListener changeListener) {
-        throw new UnsupportedOperationException("Deprecated");
-    }
-    
-    @Override
-    public void close() throws Exception {
-        
-    }
+package org.opendaylight.controller.sal.binding.impl;\r
+\r
+import java.util.concurrent.Future;\r
+import java.util.concurrent.atomic.AtomicLong;\r
+\r
+import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;\r
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;\r
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;\r
+import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderRouter;\r
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;\r
+import org.opendaylight.yangtools.yang.binding.DataObject;\r
+import org.opendaylight.yangtools.yang.binding.DataRoot;\r
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
+import org.opendaylight.yangtools.yang.common.RpcResult;\r
+\r
+\r
+public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> implements\r
+        DataProviderService, AutoCloseable {\r
+\r
+    private final AtomicLong nextTransaction = new AtomicLong();\r
+    private final AtomicLong createdTransactionsCount = new AtomicLong();\r
+    \r
+    public AtomicLong getCreatedTransactionsCount() {\r
+        return createdTransactionsCount;\r
+    }\r
+\r
+    public DataBrokerImpl() {\r
+        setDataReadRouter(new BindingAwareDataReaderRouter());\r
+    }\r
+\r
+    @Override\r
+    public DataTransactionImpl beginTransaction() {\r
+        String transactionId = "BA-" + nextTransaction.getAndIncrement();\r
+        createdTransactionsCount.getAndIncrement();\r
+        return new DataTransactionImpl(transactionId,this);\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public DataObject getData(InstanceIdentifier<? extends DataObject> data) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public DataObject getConfigurationData(InstanceIdentifier<?> data) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+\r
+    @Override\r
+    @Deprecated\r
+    public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path,\r
+            DataChangeListener changeListener) {\r
+        throw new UnsupportedOperationException("Deprecated");\r
+    }\r
+    \r
+    @Override\r
+    public void close() throws Exception {\r
+        \r
+    }\r
 }
\ No newline at end of file