当前位置: 首页>>代码示例>>Java>>正文


Java TransactionCommitFailedException类代码示例

本文整理汇总了Java中org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException的典型用法代码示例。如果您正苦于以下问题:Java TransactionCommitFailedException类的具体用法?Java TransactionCommitFailedException怎么用?Java TransactionCommitFailedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TransactionCommitFailedException类属于org.opendaylight.controller.md.sal.common.api.data包,在下文中一共展示了TransactionCommitFailedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: submit

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit(
        final DOMDataWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
    checkNotFailed();
    checkNotClosed();

    final CheckedFuture<Void, TransactionCommitFailedException> ret = broker.submit(transaction, cohorts);

    COUNTER_UPDATER.incrementAndGet(this);
    Futures.addCallback(ret, new FutureCallback<Void>() {
        @Override
        public void onSuccess(final Void result) {
            transactionCompleted();
        }

        @Override
        public void onFailure(final Throwable t) {
            transactionFailed(transaction, t);
        }
    });

    return ret;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:DOMDataBrokerTransactionChainImpl.java

示例2: listenForFailure

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
private CheckedFuture<Void, TransactionCommitFailedException> listenForFailure(
        final WriteTransaction tx, final CheckedFuture<Void, TransactionCommitFailedException> future) {
    Futures.addCallback(future, new FutureCallback<Void>() {
        @Override
        public void onFailure(final Throwable t) {
            failTransactionChain(tx,t);
        }

        @Override
        public void onSuccess(final Void result) {
            // Intentionally NOOP
        }
    });

    return future;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:BindingDOMTransactionChainAdapter.java

示例3: setTestOperData

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
private void setTestOperData(final ExecStatus sts, final long tstCompl) {
    TestStatus status = new TestStatusBuilder()
            .setExecStatus(sts)
            .setTestsCompleted(tstCompl)
            .build();

    WriteTransaction tx = simpleTxDataBroker.newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, TEST_STATUS_IID, status);

    try {
        tx.submit().checkedGet();
    } catch (final TransactionCommitFailedException e) {
        throw new IllegalStateException(e);
    }

    LOG.debug("DataStore test oper status populated: {}", status);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:DsbenchmarkProvider.java

示例4: submit

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Override
public synchronized CheckedFuture<Void, TransactionCommitFailedException> submit() {
    Preconditions.checkState(!closed, "Transaction %s is already closed", identifier);

    final Set<DOMStoreWriteTransaction> txns = ImmutableSet.copyOf(idToTransaction.values());
    final List<DOMStoreThreePhaseCommitCohort> cohorts = new ArrayList<>(txns.size());
    for (DOMStoreWriteTransaction tx : txns) {
        cohorts.add(tx.ready());
    }

    try {
        return Futures.immediateCheckedFuture(new CommitCoordinationTask(this, cohorts, null).call());
    } catch (TransactionCommitFailedException e) {
        return Futures.immediateFailedCheckedFuture(e);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:ShardedDOMDataWriteTransaction.java

示例5: submit

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit() {
    final AbstractDOMForwardedTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
    checkRunning(impl);

    final Collection<T> txns = getSubtransactions();
    final Collection<DOMStoreThreePhaseCommitCohort> cohorts = new ArrayList<>(txns.size());

    // FIXME: deal with errors thrown by backed (ready and submit can fail in theory)
    for (DOMStoreWriteTransaction txn : txns) {
        cohorts.add(txn.ready());
    }

    final CheckedFuture<Void, TransactionCommitFailedException> ret = impl.submit(this, cohorts);
    FUTURE_UPDATER.lazySet(this, ret);
    return ret;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:DOMForwardedWriteTransaction.java

示例6: submit

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Override
protected CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
        final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
    Preconditions.checkArgument(transaction != null, "Transaction must not be null.");
    Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
    LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier());

    ListenableFuture<Void> commitFuture = null;
    try {
        commitFuture = executor.submit(new CommitCoordinationTask(transaction, cohorts,
                commitStatsTracker));
    } catch(RejectedExecutionException e) {
        LOG.error("The commit executor's queue is full - submit task was rejected. \n" +
                  executor, e);
        return Futures.immediateFailedCheckedFuture(
                new TransactionCommitFailedException(
                    "Could not submit the commit task - the commit queue capacity has been exceeded.", e));
    }

    return MappingCheckedFuture.create(commitFuture,
            TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:SerializedDOMDataBroker.java

示例7: testRejectedCommit

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Test(expected=TransactionCommitFailedException.class)
public void testRejectedCommit() throws Exception {

    commitExecutor.delegate = Mockito.mock( ExecutorService.class );
    Mockito.doThrow( new RejectedExecutionException( "mock" ) )
        .when( commitExecutor.delegate ).execute( Mockito.any( Runnable.class ) );
    Mockito.doNothing().when( commitExecutor.delegate ).shutdown();
    Mockito.doReturn( Collections.emptyList() ).when( commitExecutor.delegate ).shutdownNow();
    Mockito.doReturn( "" ).when( commitExecutor.delegate ).toString();
    Mockito.doReturn( true ).when( commitExecutor.delegate )
        .awaitTermination( Mockito.anyLong(), Mockito.any( TimeUnit.class ) );

    DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
    writeTx.put( OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME) );

    writeTx.submit().checkedGet( 5, TimeUnit.SECONDS );
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:DOMBrokerTest.java

示例8: submit

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit() {
    final AbstractDOMTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
    checkRunning(impl);

    final Collection<T> txns = getSubtransactions();
    final Collection<DOMStoreThreePhaseCommitCohort> cohorts = new ArrayList<>(txns.size());

    // FIXME: deal with errors thrown by backed (ready and submit can fail in theory)
    for (final T txn : txns) {
        cohorts.add(txn.ready());
    }

    final CheckedFuture<Void, TransactionCommitFailedException> ret = impl.submit(this, cohorts);
    FUTURE_UPDATER.lazySet(this, ret);
    return ret;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:AbstractDOMBrokerWriteTransaction.java

示例9: submit

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit(
        final DOMDataWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
    checkNotFailed();
    checkNotClosed();

    final CheckedFuture<Void, TransactionCommitFailedException> ret = broker.submit(transaction, cohorts);

    COUNTER_UPDATER.incrementAndGet(this);
    Futures.addCallback(ret, new FutureCallback<Void>() {
        @Override
        public void onSuccess(final Void result) {
            transactionCompleted();
        }

        @Override
        public void onFailure(final Throwable failure) {
            transactionFailed(transaction, failure);
        }
    }, MoreExecutors.directExecutor());

    return ret;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:DOMBrokerTransactionChain.java

示例10: submit

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Override
protected CheckedFuture<Void, TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
        final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {

    Preconditions.checkArgument(transaction != null, "Transaction must not be null.");
    Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
    LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier());

    if (cohorts.isEmpty()) {
        return Futures.immediateCheckedFuture(null);
    }

    final AsyncNotifyingSettableFuture clientSubmitFuture =
            new AsyncNotifyingSettableFuture(clientFutureCallbackExecutor);

    doCanCommit(clientSubmitFuture, transaction, cohorts);

    return MappingCheckedFuture.create(clientSubmitFuture, COMMIT_ERROR_MAPPER);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:ConcurrentDOMDataBroker.java

示例11: testSubmitWithNegativeCanCommitResponse

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Test
public void testSubmitWithNegativeCanCommitResponse() throws Exception {
    doReturn(Futures.immediateFuture(true)).when(mockCohort1).canCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort1).abort();

    doReturn(Futures.immediateFuture(false)).when(mockCohort2).canCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort2).abort();

    DOMStoreThreePhaseCommitCohort mockCohort3 = mock(DOMStoreThreePhaseCommitCohort.class);
    doReturn(Futures.immediateFuture(false)).when(mockCohort3).canCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort3).abort();

    CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
            transaction, Arrays.asList(mockCohort1, mockCohort2, mockCohort3));

    assertFailure(future, null, mockCohort1, mockCohort2, mockCohort3);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:ConcurrentDOMDataBrokerTest.java

示例12: testSubmitWithPreCommitException

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Test
public void testSubmitWithPreCommitException() throws Exception {
    doReturn(Futures.immediateFuture(true)).when(mockCohort1).canCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort1).preCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort1).abort();

    doReturn(Futures.immediateFuture(true)).when(mockCohort2).canCommit();
    IllegalStateException cause = new IllegalStateException("mock");
    doReturn(Futures.immediateFailedFuture(cause)).when(mockCohort2).preCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort2).abort();

    DOMStoreThreePhaseCommitCohort mockCohort3 = mock(DOMStoreThreePhaseCommitCohort.class);
    doReturn(Futures.immediateFuture(true)).when(mockCohort3).canCommit();
    doReturn(Futures.immediateFailedFuture(new IllegalStateException("mock2")))
            .when(mockCohort3).preCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort3).abort();

    CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
            transaction, Arrays.asList(mockCohort1, mockCohort2, mockCohort3));

    assertFailure(future, cause, mockCohort1, mockCohort2, mockCohort3);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:ConcurrentDOMDataBrokerTest.java

示例13: testSubmitWithCommitException

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@Test
public void testSubmitWithCommitException() throws Exception {
    doReturn(Futures.immediateFuture(true)).when(mockCohort1).canCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort1).preCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort1).commit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort1).abort();

    doReturn(Futures.immediateFuture(true)).when(mockCohort2).canCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort2).preCommit();
    IllegalStateException cause = new IllegalStateException("mock");
    doReturn(Futures.immediateFailedFuture(cause)).when(mockCohort2).commit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort2).abort();

    DOMStoreThreePhaseCommitCohort mockCohort3 = mock(DOMStoreThreePhaseCommitCohort.class);
    doReturn(Futures.immediateFuture(true)).when(mockCohort3).canCommit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort3).preCommit();
    doReturn(Futures.immediateFailedFuture(new IllegalStateException("mock2")))
            .when(mockCohort3).commit();
    doReturn(Futures.immediateFuture(null)).when(mockCohort3).abort();

    CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
            transaction, Arrays.asList(mockCohort1, mockCohort2, mockCohort3));

    assertFailure(future, cause, mockCohort1, mockCohort2, mockCohort3);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:26,代码来源:ConcurrentDOMDataBrokerTest.java

示例14: testEmptyTransactionSubmitSucceeds

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
@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)) {

        CheckedFuture<Void, TransactionCommitFailedException> submit1 =
                dataBroker.newWriteOnlyTransaction().submit();

        assertNotNull(submit1);

        submit1.get();

        CheckedFuture<Void, TransactionCommitFailedException> submit2 =
                dataBroker.newReadWriteTransaction().submit();

        assertNotNull(submit2);

        submit2.get();
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:ConcurrentDOMDataBrokerTest.java

示例15: testBasicProducer

import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; //导入依赖的package包/类
/**
 * A simple unbound producer. It write some basic things into the data store based on the
 * test model.
 * @throws DOMDataTreeProducerException
 * @throws TransactionCommitFailedException
 */
@Test
public final void testBasicProducer() throws DOMDataTreeProducerException, TransactionCommitFailedException {
    // Create a producer. It is an AutoCloseable resource, hence the try-with pattern
    try (final DOMDataTreeProducer prod = service().createProducer(Collections.singleton(UNORDERED_CONTAINER_TREE))) {
        assertNotNull(prod);

        final DOMDataWriteTransaction tx = prod.createTransaction(true);
        assertNotNull(tx);

        tx.put(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID, ImmutableContainerNodeBuilder.create().build());

        final CheckedFuture<Void, TransactionCommitFailedException> f = tx.submit();
        assertNotNull(f);

        f.checkedGet();
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:AbstractDOMDataTreeServiceTestSuite.java


注:本文中的org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。