package org.opendaylight.controller.sal.dom.broker;
+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.common.DataStoreIdentifier;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier, CompositeNode, DataChangeListener> implements
- DataProviderService {
+ DataProviderService, AutoCloseable {
+ private AtomicLong nextTransaction = new AtomicLong();
+ private final AtomicLong createdTransactionsCount = new AtomicLong();
+
public DataBrokerImpl() {
setDataReadRouter(new DataReaderRouter());
}
-
+
+ public AtomicLong getCreatedTransactionsCount() {
+ return createdTransactionsCount;
+ }
+
@Override
public DataTransactionImpl beginTransaction() {
- return new DataTransactionImpl(this);
+ String transactionId = "DOM-" + nextTransaction.getAndIncrement();
+ createdTransactionsCount.getAndIncrement();
+ return new DataTransactionImpl(transactionId,this);
}
@Override
@Deprecated
@Override
public void addValidator(DataStoreIdentifier store, DataValidator validator) {
- // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Deprecated");
}
@Deprecated
@Override
public void removeValidator(DataStoreIdentifier store, DataValidator validator) {
- // TODO Auto-generated method stub
-
+ throw new UnsupportedOperationException("Deprecated");
}
@Deprecated
@Override
public void addRefresher(DataStoreIdentifier store, DataRefresher refresher) {
- // TODO Auto-generated method stub
-
+ throw new UnsupportedOperationException("Deprecated");
}
@Deprecated
@Override
public void removeRefresher(DataStoreIdentifier store, DataRefresher refresher) {
- // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Deprecated");
+ }
+ @Override
+ public void close() throws Exception {
+
}
}
\ No newline at end of file