boolean getLock(TXStateProxy val, TXId key) {
    if (!val.getLock().isHeldByCurrentThread()) {
      val.getLock().lock();
      synchronized (hostedTXStates) {
        TXStateProxy curVal = hostedTXStates.get(key);
        // Inflight op could be received later than TXFailover operation.
        if (curVal == null) {
          if (!isHostedTxRecentlyCompleted(key)) {
            // Failover op removed the val
            // It is possible that the same operation can be executed
            // twice by two threads, but data is consistent.
            hostedTXStates.put(key, val);
          } else {
            // Another thread should complete the transaction
            logger.info("{} has already finished.", val.getTxId());
          }
        } else {
          if (val != curVal) {
            // Failover op replaced with a new TXStateProxyImpl
            // Use the new one instead.
            val.getLock().unlock();
            return false;
          }
        }
      }
    }
    return true;
  }
Associate the remote txState with the thread processing this message. Also, we acquire a lock
on the txState, on which this thread operates. Some messages like SizeMessage should not create
a new txState.

@return {@link TXStateProxy} the txProxy for the transactional message
geode-core/src/main/java/org/apache/geode/internal/cache/TXManagerImpl.java