docs: public Connection getConnection() throws LookupException
      {
          /*
          if the connection is not null and we are not in a local tx, we check
          the connection state and release "dead" connections.
          if connection is in local tx we do nothing, the dead connection will cause
          an exception and PB instance have to handle rollback
          */
          if(con != null && !isInLocalTransaction() && !isAlive(con))
          {
              releaseConnection();
          }
          if (con == null)
          {
              con = this.connectionFactory.lookupConnection(jcd);
              if (con == null) throw new PersistenceBrokerException("Cannot get connection for " + jcd);
              if (jcd.getUseAutoCommit() == JdbcConnectionDescriptor.AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE)
              {
                  try
                  {
                      this.originalAutoCommitState = con.getAutoCommit();
                  }
                  catch (SQLException e)
                  {
                      throw new PersistenceBrokerException("Cannot request autoCommit state on the connection", e);
                  }
              }
              if (log.isDebugEnabled()) log.debug("Request new connection from ConnectionFactory: " + con);
          }
  
          if (isBatchMode())
          {
              if (batchCon == null)
              {
                  batchCon = new BatchConnection(con, broker);
              }
              return batchCon;
          }
          else
          {
              return con;
          }
      }