+ final String msg = "Unexpected exception: "
+ + Throwables.getStackTraceAsString(e.getCause());
+ if (DistributedDataStore.class.equals(testParameter)) {
+ assertTrue(Throwables.getRootCause(e) instanceof NoShardLeaderException);
+ } else {
+ assertTrue(msg, Throwables.getRootCause(e) instanceof RequestTimeoutException);
+ }
+ }
+ } finally {
+ try {
+ if (writeTxToClose != null) {
+ writeTxToClose.close();
+ }
+ } catch (Exception e) {
+ // FIXME TransactionProxy.close throws IllegalStateException:
+ // Transaction is ready, it cannot be closed