MCPcopy Create free account
hub / github.com/BaseXdb/basex / ping

Method ping

basex-core/src/main/java/org/basex/BaseXServer.java:304–317  ·  view source on GitHub ↗

Checks if a server is running. @param host host @param port server port @return boolean success

(final String host, final int port)

Source from the content-addressed store, hash-verified

302 * @return boolean success
303 */
304 public static boolean ping(final String host, final int port) {
305 try {
306 // connect server with invalid login data
307 try(ClientSession cs = new ClientSession(host, port, "", "")) { /* no action */ }
308 return false;
309 } catch(final LoginException ex) {
310 // if login was checked, server is running
311 Util.debug(ex);
312 return true;
313 } catch(final IOException ex) {
314 Util.debug(ex);
315 return false;
316 }
317 }
318
319 /**
320 * Stops the server.

Callers 3

startMethod · 0.95
initMethod · 0.95
initMethod · 0.95

Calls 1

debugMethod · 0.95

Tested by 2

initMethod · 0.76
initMethod · 0.76