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

Method close

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

Shuts down the server.

()

Source from the content-addressed store, hash-verified

189 * Shuts down the server.
190 */
191 private synchronized void close() {
192 if(!running) return;
193
194 for(final ClientListener cl : authorizing) {
195 remove(cl);
196 cl.close();
197 }
198 context.sessions.close();
199
200 try {
201 // close interactive input if server was stopped by another process
202 socket.close();
203 } catch(final IOException ex) {
204 Util.errln(ex);
205 context.log.writeServer(LogType.ERROR, Util.message(ex));
206 }
207
208 final int port = context.soptions.get(StaticOptions.SERVERPORT);
209 final String stopX = Util.info(SRV_STOPPED_PORT_X, port);
210 if(!quiet) Util.println(stopX);
211 context.log.writeServer(LogType.OK, stopX);
212
213 // close database context
214 context.close();
215
216 if(!stopFile.delete()) {
217 context.log.writeServer(LogType.ERROR, Util.info(FILE_NOT_DELETED_X, stopFile));
218 }
219 running = false;
220 }
221
222 @Override
223 protected void parseArgs() throws IOException {

Callers 1

runMethod · 0.95

Calls 9

removeMethod · 0.95
errlnMethod · 0.95
messageMethod · 0.95
infoMethod · 0.95
printlnMethod · 0.95
writeServerMethod · 0.80
closeMethod · 0.65
getMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected