- public CompletionStage<ClientLocalHistory> createLocalHistory() {
- final CompletableFuture<ClientLocalHistory> future = new CompletableFuture<>();
- context().executeInActor(currentBehavior -> createLocalHistory(currentBehavior, future));
- return 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(this, singleHistory, txId);
+ LOG.debug("{}: creating a new transaction {}", persistenceId(), tx);
+
+ return returnIfOperational(transactions, txId, tx, aborted);