public static int ping(String url) throws Exception {
  URL u=new URL(url);
  HttpURLConnection c=(HttpURLConnection)u.openConnection();
  c.connect();
  int code=c.getResponseCode();
  log.debug("ping=" + url + ", response.code="+ code);
  c.disconnect();
  return code;
}

public static int ping ( String url ) throws Exception { URL u = new URL ( url ) ; HttpURLConnection c = ( HttpURLConnection ) u . openConnection ( ) ; c . connect ( ) ; int code = c . getResponseCode ( ) ; log . debug ( "ping=" + url + ", response.code=" + code ) ; c . disconnect ( ) ; return code ; }
ping the url , throw exception if occur error
