示例#1
0
 private void handleAdmin(SolrQueryRequest req, SolrQueryResponse rsp, SolrParams params) {
   String action = params.get("action");
   if ("stop".equalsIgnoreCase(action)) {
     String id = params.get("id");
     DaemonStream d = daemons.get(id);
     if (d != null) {
       d.close();
       rsp.add("result-set", new DaemonResponseStream("Deamon:" + id + " stopped on " + coreName));
     } else {
       rsp.add(
           "result-set", new DaemonResponseStream("Deamon:" + id + " not found on " + coreName));
     }
   } else if ("start".equalsIgnoreCase(action)) {
     String id = params.get("id");
     DaemonStream d = daemons.get(id);
     d.open();
     rsp.add("result-set", new DaemonResponseStream("Deamon:" + id + " started on " + coreName));
   } else if ("list".equalsIgnoreCase(action)) {
     Collection<DaemonStream> vals = daemons.values();
     rsp.add("result-set", new DaemonCollectionStream(vals));
   } else if ("kill".equalsIgnoreCase(action)) {
     String id = params.get("id");
     DaemonStream d = daemons.remove(id);
     if (d != null) {
       d.close();
     }
     rsp.add("result-set", new DaemonResponseStream("Deamon:" + id + " killed on " + coreName));
   }
 }