purgedHistories = MutableUnsignedLongSet.of();
// History for stand-alone transactions is always present
- standaloneId = new LocalHistoryIdentifier(clientId, 0);
+ standaloneId = StandaloneFrontendHistory.identifierForClient(clientId);
currentHistories.put(standaloneId, new FrontendHistoryMetadataBuilder(standaloneId));
}
}
// Sanity check and recovery
- standaloneId = new LocalHistoryIdentifier(clientId, 0);
+ standaloneId = StandaloneFrontendHistory.identifierForClient(clientId);
currentHistories.computeIfAbsent(standaloneId, missingId -> {
LOG.warn("{}: Client {} recovered histories {} do not contain stand-alone history, attempting recovery",
shardName, clientId, currentHistories);
/**
* Standalone transaction specialization of {@link AbstractFrontendHistory}. There can be multiple open transactions
* and they are submitted in any order.
- *
- * @author Robert Varga
*/
final class StandaloneFrontendHistory extends AbstractFrontendHistory {
private final @NonNull LocalHistoryIdentifier identifier;
final ShardDataTree tree, final Map<UnsignedLong, Boolean> closedTransactions,
final MutableUnsignedLongSet purgedTransactions) {
super(persistenceId, tree, closedTransactions, purgedTransactions);
- identifier = new LocalHistoryIdentifier(clientId, 0);
this.tree = requireNonNull(tree);
+ identifier = identifierForClient(clientId);
+ }
+
+ static @NonNull LocalHistoryIdentifier identifierForClient(final ClientIdentifier clientId) {
+ return new LocalHistoryIdentifier(clientId, 0);
}
static @NonNull StandaloneFrontendHistory create(final String persistenceId, final ClientIdentifier clientId,