- private void checkNotClosed() {
- if (state == CLOSED_STATE) {
- throw new IllegalStateException("Local history " + new LocalHistoryIdentifier(clientId, historyId) + " is closed");
- }
+ public ClientTransaction createTransaction() {
+ final State local = state();
+ Preconditions.checkState(local == State.IDLE, "Local history %s state is %s", this, local);
+ updateState(local, State.TX_OPEN);
+
+ return new ClientTransaction(getClient(), this,
+ new TransactionIdentifier(getIdentifier(), NEXT_TX_UPDATER.getAndIncrement(this)));