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

Method run

basex-core/src/main/java/org/basex/core/cmd/Kill.java:27–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 }
26
27 @Override
28 protected boolean run() {
29 if(!run(0, false) || count == 0) {
30 error(Locking.CONTEXT);
31
32 // kill all sessions with the specified IP (and optional port)
33 final Sessions ss = context.sessions;
34 final String arg = args[0];
35 for(int s = ss.size() - 1; s >= 0; --s) {
36 final ClientListener cl = ss.get(s);
37 final String cs = cl.toString().replaceAll("[]\\[]", "");
38 if(cl.context() == context) {
39 // show error if own session is addressed
40 if(cs.equals(arg)) return error(KILL_SELF_X, arg);
41 } else if(cs.startsWith(arg)) {
42 info(LI + cs);
43 cl.close();
44 count++;
45 }
46 }
47 }
48 return info(SESSIONS_KILLED_X, count);
49 }
50
51 @Override
52 protected boolean run(final String user, final String db) {

Callers

nothing calls this directly

Calls 11

toStringMethod · 0.95
contextMethod · 0.95
closeMethod · 0.95
userMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65
infoMethod · 0.65
nameMethod · 0.65
errorMethod · 0.45
equalsMethod · 0.45
startsWithMethod · 0.45

Tested by

no test coverage detected