本文整理汇总了Java中org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction类的典型用法代码示例。如果您正苦于以下问题:Java AsyncTransaction类的具体用法?Java AsyncTransaction怎么用?Java AsyncTransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AsyncTransaction类属于org.opendaylight.controller.md.sal.common.api.data包,在下文中一共展示了AsyncTransaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
final AsyncTransaction<?, ?> transaction, final Throwable cause) {
Preconditions.checkState(delegate.equals(chain),
"Illegal state - listener for %s was invoked for incorrect chain %s.", delegate, chain);
/*
* Intentionally NOOP, callback for failure, since we
* are also listening on each transaction future for failure,
* in order to have reference to Binding Transaction (which was seen by client
* of this transaction chain), instead of DOM transaction
* which is known only to this chain, binding transaction implementation
* and underlying transaction chain.
*
*/
LOG.debug("Transaction chain {} failed. Failed DOM Transaction {}",this,transaction,cause);
}
示例2: testResetTransactionQueue
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Test
public void testResetTransactionQueue() throws Exception {
doNothing().when(chain).close();
when(db.createTransactionChain(any(TransactionInvokerImpl.class))).thenReturn(chain);
failedTransactionQ.add(mock(AsyncTransaction.class));
field(TransactionInvokerImpl.class, "pendingTransactions").set(transactionInvokerImpl, pendingTransactions);
field(TransactionInvokerImpl.class, "transactionToCommand").set(transactionInvokerImpl, transactionToCommand);
field(TransactionInvokerImpl.class, "failedTransactionQueue").set(transactionInvokerImpl, failedTransactionQ);
field(TransactionInvokerImpl.class, "successfulTransactionQueue").set(transactionInvokerImpl, successfulTxQ);
Whitebox.invokeMethod(transactionInvokerImpl, "resetTransactionQueue");
assertNotNull(Whitebox.getInternalState(transactionInvokerImpl, "pendingTransactions"));
assertNotNull(Whitebox.getInternalState(transactionInvokerImpl, "transactionToCommand"));
BlockingQueue<AsyncTransaction<?, ?>> testFailedTransactionQueue = Whitebox
.getInternalState(transactionInvokerImpl, "failedTransactionQueue");
assertEquals(0, testFailedTransactionQueue.size());
}
示例3: extractResubmitCommands
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
private List<TransactionCommand> extractResubmitCommands() {
AsyncTransaction<?, ?> transaction = failedTransactionQueue.poll();
List<TransactionCommand> commands = new ArrayList<>();
if (transaction != null) {
int index = pendingTransactions.lastIndexOf(transaction);
//This logic needs to be revisited. Is it ok to resubmit these things again ?
//are these operations idempotent ?
//Does the transaction chain execute n+1th if nth one threw error ?
List<ReadWriteTransaction> transactions =
pendingTransactions.subList(index, pendingTransactions.size() - 1);
for (ReadWriteTransaction tx: transactions) {
commands.add(transactionToCommand.get(tx));
}
resetTransactionQueue();
}
if (commandIterator != null) {
while (commandIterator.hasNext()) {
commands.add(commandIterator.next());
}
}
return commands;
}
示例4: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> transactionChain,
final org.opendaylight.mdsal.common.api.AsyncTransaction<?, ?> asyncTransaction,
final Throwable throwable) {
txChainListener.onTransactionChainFailed(
this, transactionFromDelegate(asyncTransaction.getIdentifier()), throwable);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:ShardedDOMDataBrokerDelegatingTransactionChain.java
示例5: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
final AsyncTransaction<?, ?> transaction, final Throwable cause) {
// This is expected to happen frequently in isolation testing.
LOG.debug("Transaction chain failed.", cause);
// Do not return RPC here, rely on transaction failure to call runFailed.
}
示例6: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public void onTransactionChainFailed(TransactionChain<?, ?> chain, AsyncTransaction<?, ?> transaction,
Throwable cause) {
// TODO Auto-generated method stub
LOG.error("RibManager for {} failed in transaction {}", localRibRef.getInstanceIdentifier(),
transaction != null ? transaction.getIdentifier() : null, cause);
}
示例7: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> pchain, final AsyncTransaction<?, ?> transaction,
final Throwable cause) {
// FIXME: flip internal state, so that the next attempt to update fails, triggering node reconnect
LOG.error("Unexpected transaction failure in node {} transaction {}",
this.nodeId, transaction.getIdentifier(), cause);
}
示例8: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public final synchronized void onTransactionChainFailed(final TransactionChain<?, ?> transactionChain,
final AsyncTransaction<?, ?> transaction, final Throwable cause) {
LOG.error("Topology builder for {} failed in transaction {}.", getInstanceIdentifier(),
transaction != null ? transaction.getIdentifier() : null, cause);
scheduleListenerRestart();
restartTransactionChainOnDemand();
}
示例9: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public synchronized void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction, final Throwable cause) {
LOG.error("Broken chain in RIB {} transaction {}", getInstanceIdentifier(), transaction != null ? transaction.getIdentifier() : null, cause);
if (this.txChainToLocRibWriter.containsKey(chain)) {
final LocRibWriter locRibWriter = this.txChainToLocRibWriter.remove(chain);
final DOMTransactionChain newChain = createPeerChain(this);
locRibWriter.restart(newChain);
this.txChainToLocRibWriter.put(newChain, locRibWriter);
}
}
示例10: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public synchronized void onTransactionChainFailed(final TransactionChain<?, ?> chain,
final AsyncTransaction<?, ?> transaction, final Throwable cause) {
LOG.error("Transaction chain failed.", cause);
this.chain.close();
this.chain = this.rib.createPeerChain(this);
this.ribWriter = AdjRibInWriter.create(this.rib.getYangRibId(), this.peerRole, this.simpleRoutingPolicy,
this.chain);
releaseConnection();
}
示例11: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction,
final Throwable cause) {
LOG.error("Broken chain {} in DatastoreBaAbstractWrite, transaction {}, cause {}", chain,
transaction.getIdentifier(), cause);
close();
}
示例12: extractResubmitCommands
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
private List<TransactionCommand> extractResubmitCommands() {
AsyncTransaction<?, ?> transaction = failedTransactionQueue.poll();
List<TransactionCommand> commands = new ArrayList<>();
if (transaction != null) {
int index = pendingTransactions.lastIndexOf(transaction);
List<ReadWriteTransaction> transactions =
pendingTransactions.subList(index, pendingTransactions.size() - 1);
for (ReadWriteTransaction tx: transactions) {
commands.add(transactionToCommand.get(tx));
}
resetTransactionQueue();
}
return commands;
}
示例13: testOnTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Test
public void testOnTransactionChainFailed() throws Exception {
field(TransactionInvokerImpl.class, "failedTransactionQueue").set(transactionInvokerImpl,
failedTransactionQ);
AsyncTransaction<?, ?> transaction = mock(AsyncTransaction.class);
Throwable cause = mock(Throwable.class);
transactionInvokerImpl.onTransactionChainFailed(mock(TransactionChain.class), transaction, cause);
BlockingQueue<AsyncTransaction<?, ?>> testFailedTransactionQueue = Whitebox
.getInternalState(transactionInvokerImpl, "failedTransactionQueue");
assertTrue(testFailedTransactionQueue.contains(transaction));
}
示例14: testExtractResubmitCommands
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Test
public void testExtractResubmitCommands() throws Exception {
AsyncTransaction<?, ?> transaction = mock(ReadWriteTransaction.class);
failedTransactionQ.put(transaction);
field(TransactionInvokerImpl.class, "failedTransactionQueue").set(transactionInvokerImpl,
failedTransactionQ);
AsyncTransaction tx1 = mock(ReadWriteTransaction.class);
AsyncTransaction tx2 = mock(ReadWriteTransaction.class);
pendingTransactions.add((ReadWriteTransaction) tx1);
pendingTransactions.add((ReadWriteTransaction) transaction);
pendingTransactions.add((ReadWriteTransaction) tx2);
MemberModifier.field(TransactionInvokerImpl.class, "pendingTransactions").set(transactionInvokerImpl,
pendingTransactions);
List<ReadWriteTransaction> transactions = new ArrayList<>();
transactions.add((ReadWriteTransaction) tx1);
TransactionCommand txCommand = mock(TransactionCommand.class);
transactionToCommand.put((ReadWriteTransaction) tx1, txCommand);
transactionToCommand.put((ReadWriteTransaction) tx2, txCommand);
transactionToCommand.put((ReadWriteTransaction) transaction, txCommand);
MemberModifier.field(TransactionInvokerImpl.class, "transactionToCommand").set(transactionInvokerImpl,
transactionToCommand);
PowerMockito.suppress(MemberModifier.method(TransactionInvokerImpl.class, "resetTransactionQueue"));
List<TransactionCommand> testCommands = new ArrayList<>();
testCommands.add(txCommand);
assertEquals(testCommands, Whitebox.invokeMethod(transactionInvokerImpl, "extractResubmitCommands"));
}
示例15: onTransactionChainFailed
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; //导入依赖的package包/类
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
final AsyncTransaction<?, ?> transaction, final Throwable cause) {
LOG.error("Broken chain {} in TxchainBaDelete, transaction {}, cause {}",
chain, transaction.getIdentifier(), cause);
}