public int getTransactionID() {
   return c_TransactionID.get();
 } // getTransactionID
  public void execute() throws ModbusIOException, ModbusSlaveException, ModbusException {
    // 1. assert executeability
    assertExecutable();

    try {
      // 2. Lock transaction
      /**
       * Note: The way this explicit synchronization is implemented at the moment, there is no
       * ordering of pending threads. The Mutex will simply call notify() and the JVM will handle
       * the rest.
       */
      m_TransactionLock.acquire();

      // 3. write request, and read response,
      // while holding the lock on the IO object
      synchronized (m_IO) {
        int tries = 0;
        boolean finished = false;

        // toggle the id
        m_Request.setTransactionID(c_TransactionID.increment());

        do {
          try {
            if (m_TransDelayMS > 0) {
              try {
                // Thread.sleep(m_TransDelayMS);
                Thread.sleep(10);
              } catch (InterruptedException ex) {
                System.err.println("InterruptedException: " + ex.getMessage());
              }
            }
            // write request message
            m_IO.writeMessage(m_Request);

            try {
              // Thread.sleep(m_TransDelayMS);
              Thread.sleep(20);
            } catch (InterruptedException ex) {
              System.err.println("InterruptedException: " + ex.getMessage());
            }

            // read response message
            m_Response = m_IO.readResponse();
            finished = true;
          } catch (ModbusIOException e) {
            if (++tries >= m_Retries) {
              throw e;
            }
            System.err.println("execute try " + tries + " error: " + e.getMessage());
            // throw e;
          }
        } while (!finished);
      }

      // 4. deal with exceptions
      if (m_Response instanceof ExceptionResponse) {
        throw new ModbusSlaveException(((ExceptionResponse) m_Response).getExceptionCode());
      }

      if (isCheckingValidity()) {
        checkValidity();
      }
    } catch (InterruptedException ex) {
      throw new ModbusIOException("Thread acquiring lock was interrupted.");
    } finally {
      m_TransactionLock.release();
    }
  } // execute