-
- private static final AtomicLong counter = new AtomicLong();
-
- private static final Logger
- LOG = LoggerFactory.getLogger(TransactionProxy.class);
-
-
- private final TransactionType transactionType;
- private final ActorContext actorContext;
- private final Map<String, TransactionContext> remoteTransactionPaths = new HashMap<>();
- private final TransactionIdentifier identifier;
- private final SchemaContext schemaContext;
- private boolean inReadyState;
-
- public TransactionProxy(ActorContext actorContext, TransactionType transactionType,
- SchemaContext schemaContext) {
- this.actorContext = Preconditions.checkNotNull(actorContext, "actorContext should not be null");
- this.transactionType = Preconditions.checkNotNull(transactionType, "transactionType should not be null");
- this.schemaContext = Preconditions.checkNotNull(schemaContext, "schemaContext should not be null");
-
- String memberName = actorContext.getCurrentMemberName();
- if(memberName == null){
- memberName = "UNKNOWN-MEMBER";
- }
-
- this.identifier = TransactionIdentifier.builder().memberName(memberName).counter(
- counter.getAndIncrement()).build();
-
- LOG.debug("Created txn {} of type {}", identifier, transactionType);
-
+ private static final Logger LOG = LoggerFactory.getLogger(TransactionProxy.class);
+
+ private final Map<String, TransactionContextWrapper> txContextAdapters = new HashMap<>();
+ private final AbstractTransactionContextFactory<?> txContextFactory;
+ private final TransactionType type;
+ private TransactionState state = TransactionState.OPEN;
+ private volatile OperationCompleter operationCompleter;
+ private volatile Semaphore operationLimiter;
+
+ @VisibleForTesting
+ public TransactionProxy(final AbstractTransactionContextFactory<?> txContextFactory, final TransactionType type) {
+ super(txContextFactory.nextIdentifier(), txContextFactory.getActorContext().getDatastoreContext()
+ .isTransactionDebugContextEnabled());
+ this.txContextFactory = txContextFactory;
+ this.type = Preconditions.checkNotNull(type);
+
+ LOG.debug("New {} Tx - {}", type, getIdentifier());