- public CompletionStage<ClientLocalHistory> createLocalHistory() {
- final CreateLocalHistoryCommand command = new CreateLocalHistoryCommand();
- self().tell(command, ActorRef.noSender());
- return command.future();
+ public ClientLocalHistory createLocalHistory() {
+ final LocalHistoryIdentifier historyId = new LocalHistoryIdentifier(getIdentifier(),
+ nextHistoryId.getAndIncrement());
+ final ClientLocalHistory history = new ClientLocalHistory(this, historyId);
+ LOG.debug("{}: creating a new local history {}", persistenceId(), history);
+
+ return returnIfOperational(histories, historyId, history, aborted);
+ }
+
+ @Override
+ public ClientTransaction createTransaction() {
+ final TransactionIdentifier txId = new TransactionIdentifier(singleHistory.getIdentifier(),
+ nextTransactionId.getAndIncrement());
+ final ClientTransaction tx = new ClientTransaction(singleHistory, txId);
+ LOG.debug("{}: creating a new transaction {}", persistenceId(), tx);
+
+ return returnIfOperational(transactions, txId, tx, aborted);