- private volatile Future<?> commitFuture;
-
- protected DOMBrokerWriteOnlyTransaction(final Object identifier,
- Map storeTxFactories, final AbstractDOMTransactionFactory<?> commitImpl) {
- super(identifier, storeTxFactories);
- this.commitImpl = Preconditions.checkNotNull(commitImpl, "commitImpl must not be null.");
- }
-
- @Override
- protected T createTransaction(LogicalDatastoreType key) {
- // FIXME : Casting shouldn't be necessary here
- return (T) getTxFactory(key).newWriteOnlyTransaction();
- }
-
- @Override
- public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
- checkRunning(commitImpl);
- getSubtransaction(store).write(path, data);
- }
-
- @Override
- public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
- checkRunning(commitImpl);
- getSubtransaction(store).delete(path);
- }
-
- @Override
- public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
- checkRunning(commitImpl);
- getSubtransaction(store).merge(path, data);
- }
-
- @Override
- public boolean cancel() {
- final AbstractDOMTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
- if (impl != null) {
- LOG.trace("Transaction {} cancelled before submit", getIdentifier());
- FUTURE_UPDATER.lazySet(this, CANCELLED_FUTURE);
- closeSubtransactions();
- return true;
- }
-
- // The transaction is in process of being submitted or cancelled. Busy-wait
- // for the corresponding future.
- Future<?> future;
- do {
- future = commitFuture;
- } while (future == null);
-
- return future.cancel(false);
+ public DOMBrokerWriteOnlyTransaction(Object identifier,
+ Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories,
+ AbstractDOMTransactionFactory<?> commitImpl) {
+ super(identifier, storeTxFactories, commitImpl);