TXManagerImpl implements CacheTransactionManager, MembershipListener { TXStateProxy getOrSetHostedTXState(TXId key, TransactionMessage msg) { TXStateProxy val = this.hostedTXStates.get(key); if (val == null) { synchronized (this.hostedTXStates) { val = this.hostedTXStates.get(key); if (val == null && msg.canStartRemoteTransaction()) { if (msg.isTransactionDistributed()) { val = new DistTXStateProxyImplOnDatanode(cache, this, key, msg.getTXOriginatorClient(), statisticsClock); val.setLocalTXState(new DistTXState(val, true, statisticsClock)); } else { val = new TXStateProxyImpl(cache, this, key, msg.getTXOriginatorClient(), statisticsClock); val.setLocalTXState(new TXState(val, true, statisticsClock)); val.setTarget(cache.getDistributedSystem().getDistributedMember()); } this.hostedTXStates.put(key, val); } } } return val; } TXManagerImpl(CachePerfStats cachePerfStats, InternalCache cache,
      StatisticsClock statisticsClock); static TXManagerImpl getCurrentInstanceForTest(); static void setCurrentInstanceForTest(TXManagerImpl instance); @Override TransactionWriter getWriter(); @Override void setWriter(TransactionWriter writer); @Override TransactionListener getListener(); @Override TransactionListener[] getListeners(); @Override TransactionListener setListener(TransactionListener newListener); @Override void addListener(TransactionListener aListener); @Override void removeListener(TransactionListener aListener); @Override void initListeners(TransactionListener[] newListeners); @Override void begin(); TXStateProxy beginJTA(); void precommit(); @Override void commit(); @Override void rollback(); @Override boolean exists(); @Override TransactionId getTransactionId(); TXStateProxy getTXState(); boolean setInProgress(boolean progress); void setTXState(TXStateProxy val); void close(); TXStateProxy pauseTransaction(); TXStateProxy internalSuspend(); void unpauseTransaction(TXStateProxy tx); void internalResume(TXStateProxy tx); boolean isTransactionPaused(); boolean isJTAPaused(); @Deprecated void resume(TXStateProxy tx); boolean isClosed(); static int getCurrentTXUniqueId(); static TXStateProxy getCurrentTXState(); static void incrementTXUniqueIDForReplay(); int getMyTXUniqueId(); TXStateProxy masqueradeAs(TransactionMessage msg); TXStateProxy masqueradeAs(Message msg, InternalDistributedMember memberId,
      boolean probeOnly); void masqueradeAs(TXStateProxy txState); void unmasquerade(TXStateProxy tx); TXStateProxy removeHostedTXState(TXId txId); TXStateProxy removeHostedTXState(TXId txId, boolean causedByFailover); void removeHostedTXState(Set<TXId> txIds); boolean isHostedTxInProgress(TXId txId); TXStateProxy getHostedTXState(TXId txId); int hostedTransactionsInProgressForTest(); int localTransactionsInProgressForTest(); @Override void memberDeparted(DistributionManager distributionManager, InternalDistributedMember id,
      boolean crashed); @Override void memberJoined(DistributionManager distributionManager, InternalDistributedMember id); @Override void quorumLost(DistributionManager distributionManager,
      Set<InternalDistributedMember> failures, List<InternalDistributedMember> remaining); @Override void memberSuspect(DistributionManager distributionManager, InternalDistributedMember id,
      InternalDistributedMember whoSuspected, String reason); Set<TXId> getTransactionsForClient(InternalDistributedMember id); Set<TXStateProxy> getTransactionStatesForClient(InternalDistributedMember id); void removeExpiredClientTransactions(Set<TXId> txIds); @VisibleForTesting /* remove the given TXStates for test */ void removeTransactions(Set<TXId> txIds, boolean distribute); void saveTXCommitMessageForClientFailover(TXId txId, TXCommitMessage msg); boolean isHostedTxRecentlyCompleted(TXId txId); boolean waitForCompletingTransaction(TXId txId); TXCommitMessage getRecentlyCompletedMessage(TXId txId); boolean isExceptionToken(TXCommitMessage msg); RuntimeException getExceptionForToken(TXCommitMessage msg, TXId txId); void expireDisconnectedClientTransactions(Set<TXId> txIds, boolean distribute); @Override TransactionId suspend(); @Override void resume(TransactionId transactionId); @Override boolean isSuspended(TransactionId transactionId); @Override boolean tryResume(TransactionId transactionId); @Override boolean tryResume(TransactionId transactionId, long time, TimeUnit unit); @Override boolean exists(TransactionId transactionId); void setSuspendedTransactionTimeout(long timeout); long getSuspendedTransactionTimeout(); static void incRefCount(AbstractRegionEntry re); static boolean decRefCount(AbstractRegionEntry re); Set<TXId> getLocalTxIds(); ArrayList<TXId> getHostedTxIds(); void setTransactionTimeToLiveForTest(int seconds); int getTransactionTimeToLive(); InternalDistributedMember getMemberId(); Set<InternalDistributedMember> getDepartedProxyServers(); void removeTransactionsSentFromDepartedProxy(InternalDistributedMember proxyServer); @Override void setDistributed(boolean flag); @Override boolean isDistributed(); boolean isHostedTXStatesEmpty(); Set<TXId> getScheduledToBeRemovedTx(); @VisibleForTesting int getFailoverMapSize(); static final int NOTX; public TransactionWriter writer; static final int FAILOVER_TX_MAP_SIZE; @MutableForTesting
  static boolean ALLOW_PERSISTENT_TRANSACTIONS; }
@Test public void testTxStateWithNotFinishedTx() { TXStateProxy tx = txMgr.getOrSetHostedTXState(notCompletedTxid, msg); assertTrue(tx.isInProgress()); }