public void run() {
while (true) {
forgetSuccessfulTransactions();
+
+ List<TransactionCommand> commands = null;
+ try {
+ commands = extractCommands();
+ } catch (InterruptedException e) {
+ LOG.warn("Extracting commands was interrupted.", e);
+ continue;
+ }
+
+ ReadWriteTransaction transactionInFlight = null;
try {
- List<TransactionCommand> commands = extractCommands();
for (TransactionCommand command: commands) {
final ReadWriteTransaction transaction = chain.newReadWriteTransaction();
+ transactionInFlight = transaction;
recordPendingTransaction(command, transaction);
command.execute(transaction);
Futures.addCallback(transaction.submit(), new FutureCallback<Void>() {
}
});
}
- } catch (Exception e) {
- LOG.warn("Exception invoking Transaction: ", e);
+ } catch (IllegalStateException e) {
+ if (transactionInFlight != null) {
+ // TODO: This method should distinguish exceptions on which the command should be
+ // retried from exceptions on which the command should NOT be retried.
+ // Then it should retry only the commands which should be retried, otherwise
+ // this method will retry commands which will never be successful forever.
+ failedTransactionQueue.offer(transactionInFlight);
+ }
+ LOG.warn("Failed to process an update notification from OVS.", e);
}
}
}
public void run() {
while (runTask.get()) {
forgetSuccessfulTransactions();
+
+ List<TransactionCommand> commands = null;
+ try {
+ commands = extractCommands();
+ } catch (InterruptedException e) {
+ LOG.warn("Extracting commands was interrupted.", e);
+ continue;
+ }
+
+ ReadWriteTransaction transactionInFlight = null;
try {
- List<TransactionCommand> commands = extractCommands();
for (TransactionCommand command: commands) {
final ReadWriteTransaction transaction = chain.newReadWriteTransaction();
+ transactionInFlight = transaction;
recordPendingTransaction(command, transaction);
command.execute(transaction);
Futures.addCallback(transaction.submit(), new FutureCallback<Void>() {
}
});
}
- } catch (InterruptedException e) {
- LOG.warn("Exception invoking Transaction: ", e);
+ } catch (IllegalStateException e) {
+ if (transactionInFlight != null) {
+ // TODO: This method should distinguish exceptions on which the command should be
+ // retried from exceptions on which the command should NOT be retried.
+ // Then it should retry only the commands which should be retried, otherwise
+ // this method will retry commands which will never be successful forever.
+ failedTransactionQueue.offer(transactionInFlight);
+ }
+ LOG.warn("Failed to process an update notification from OVS.", e);
}
}
}