X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2FCommandThread.java;h=78c56527a40d77c2a47677e44c8838a706cb1061;hb=46440016f16326b6004b03b74582596b532f0261;hp=e3169b9cbe0617095979703d6d794c2d79e56099;hpb=249aba186bb25b673bc701f4614cfe1981cd6767;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java b/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java index e3169b9..78c5652 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java @@ -9,7 +9,7 @@ public class CommandThread extends Thread { private static Logger logger = Logger.getLogger(CommandThread.class); Pazpar2Command command; SearchClient client; - CommandResponse commandResponse = null; + HttpResponseWrapper commandResponse = null; public CommandThread (Pazpar2Command command, SearchClient client) { this.command = command; @@ -17,31 +17,18 @@ public class CommandThread extends Thread { } /** - * Runs the specified command using the specified Pazpar2 client - * Sets the Pazpar2 response as an XML response string to be retrieved by - * getResponse(). - * - * In case of an exception, an error response is generated, the document - * element being the same as it would have been if successful (named after - * the command, that is). - * + * Executes the specified command using the specified Pazpar2 client */ - public void run() { - - if (command.getCommandName().equals("search")) { - client.setSearchCommand(command); - } - long start = System.currentTimeMillis(); + public void run() { + logger.debug(command.getCommandName() + " executing asynchronously"); commandResponse = client.executeCommand(command); - long end = System.currentTimeMillis(); - logger.debug("Executed " + command.getCommandName() + " in " + (end-start) + " ms." ); } /** * * @return Pazpar2 response as an XML string, possibly a generated error XML */ - public CommandResponse getCommandResponse () { + public HttpResponseWrapper getCommandResponse () { return commandResponse; }