+ @Override
+ AbstractTransactionCommitCohort onTransactionReady(final ClientTransaction tx,
+ final AbstractTransactionCommitCohort cohort) {
+
+ final State local = state();
+ switch (local) {
+ case CLOSED:
+ return super.onTransactionReady(tx, cohort);
+ case IDLE:
+ throw new IllegalStateException(String.format("Local history %s is idle when readying transaction %s",
+ this, tx.getIdentifier()));
+ case TX_OPEN:
+ updateState(local, State.IDLE);
+ return super.onTransactionReady(tx, cohort);
+ default:
+ throw new IllegalStateException(String.format("Local history %s in unhandled state %s", this, local));
+
+ }
+ }
+
+ @Override
+ ProxyHistory createHistoryProxy(final LocalHistoryIdentifier historyId,
+ final AbstractClientConnection<ShardBackendInfo> connection) {
+ return ProxyHistory.createClient(this, connection, historyId);
+ }