code: public boolean isAlive(Connection conn)
      {
          try
          {
              return con != null ? !con.isClosed() : false;
          }
          catch (SQLException e)
          {
              log.error("IsAlive check failed, running connection was invalid!!", e);
              return false;
          }
      }
docs: Check if underlying connection was alive.