@Test public void testEmptyTransactionSubmitSucceeds() throws ExecutionException, InterruptedException { DOMStore domStore = mock(DOMStore.class); try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of( LogicalDatastoreType.OPERATIONAL, domStore, LogicalDatastoreType.CONFIGURATION, domStore), futureExecutor)) { FluentFuture<? extends CommitInfo> submit1 = dataBroker.newWriteOnlyTransaction().commit(); assertNotNull(submit1); submit1.get(); FluentFuture<? extends CommitInfo> submit2 = dataBroker.newReadWriteTransaction().commit(); assertNotNull(submit2); submit2.get(); } }
@Override protected FluentFuture<? extends CommitInfo> commit(final DOMDataTreeWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) { checkArgument(transaction != null, "Transaction must not be null."); checkArgument(cohorts != null, "Cohorts must not be null."); LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier()); if (cohorts.isEmpty()) { return CommitInfo.emptyFluentFuture(); } final AsyncNotifyingSettableFuture clientSubmitFuture = new AsyncNotifyingSettableFuture(clientFutureCallbackExecutor); doCanCommit(clientSubmitFuture, transaction, cohorts); return FluentFuture.from(clientSubmitFuture).transform(ignored -> CommitInfo.empty(), MoreExecutors.directExecutor()); }
ConcurrentDOMDataBroker extends AbstractDOMBroker { @Override protected FluentFuture<? extends CommitInfo> commit(final DOMDataTreeWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) { checkArgument(transaction != null, "Transaction must not be null."); checkArgument(cohorts != null, "Cohorts must not be null."); LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier()); if (cohorts.isEmpty()) { return CommitInfo.emptyFluentFuture(); } final AsyncNotifyingSettableFuture clientSubmitFuture = new AsyncNotifyingSettableFuture(clientFutureCallbackExecutor); doCanCommit(clientSubmitFuture, transaction, cohorts); return FluentFuture.from(clientSubmitFuture).transform(ignored -> CommitInfo.empty(), MoreExecutors.directExecutor()); } }
ConcurrentDOMDataBroker extends AbstractDOMBroker { @Override protected FluentFuture<? extends CommitInfo> commit(final DOMDataTreeWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) { checkArgument(transaction != null, "Transaction must not be null."); checkArgument(cohorts != null, "Cohorts must not be null."); LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier()); if (cohorts.isEmpty()) { return CommitInfo.emptyFluentFuture(); } final AsyncNotifyingSettableFuture clientSubmitFuture = new AsyncNotifyingSettableFuture(clientFutureCallbackExecutor); doCanCommit(clientSubmitFuture, transaction, cohorts); return FluentFuture.from(clientSubmitFuture).transform(ignored -> CommitInfo.empty(), MoreExecutors.directExecutor()); } ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
            final Executor listenableFutureExecutor);  ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
            final Executor listenableFutureExecutor, final DurationStatisticsTracker commitStatsTracker); }
ConcurrentDOMDataBroker extends AbstractDOMBroker { @Override protected FluentFuture<? extends CommitInfo> commit(final DOMDataTreeWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) { checkArgument(transaction != null, "Transaction must not be null."); checkArgument(cohorts != null, "Cohorts must not be null."); LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier()); if (cohorts.isEmpty()) { return CommitInfo.emptyFluentFuture(); } final AsyncNotifyingSettableFuture clientSubmitFuture = new AsyncNotifyingSettableFuture(clientFutureCallbackExecutor); doCanCommit(clientSubmitFuture, transaction, cohorts); return FluentFuture.from(clientSubmitFuture).transform(ignored -> CommitInfo.empty(), MoreExecutors.directExecutor()); } ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
            final Executor listenableFutureExecutor);  ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
            final Executor listenableFutureExecutor, final DurationStatisticsTracker commitStatsTracker); DurationStatisticsTracker getCommitStatsTracker(); @Override String toString(); }
ConcurrentDOMDataBroker extends AbstractDOMBroker { @Override protected FluentFuture<? extends CommitInfo> commit(final DOMDataTreeWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) { checkArgument(transaction != null, "Transaction must not be null."); checkArgument(cohorts != null, "Cohorts must not be null."); LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier()); if (cohorts.isEmpty()) { return CommitInfo.emptyFluentFuture(); } final AsyncNotifyingSettableFuture clientSubmitFuture = new AsyncNotifyingSettableFuture(clientFutureCallbackExecutor); doCanCommit(clientSubmitFuture, transaction, cohorts); return FluentFuture.from(clientSubmitFuture).transform(ignored -> CommitInfo.empty(), MoreExecutors.directExecutor()); } ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
            final Executor listenableFutureExecutor);  ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
            final Executor listenableFutureExecutor, final DurationStatisticsTracker commitStatsTracker); DurationStatisticsTracker getCommitStatsTracker(); @Override String toString();  }