예제 #1
0
 private void honorUserSchedules() {
   Set<String> toRemove = new HashSet<String>();
   List<Work> unscheduled = new ArrayList<Work>();
   for (Work work : works) {
     DriverContext driver = fetchDriver(work.getDriver());
     if (driver == null) {
       unscheduled.add(work);
       continue;
     }
     toRemove.add(driver.getName());
     schedules.addSchedule(createSchedule(work, driver));
   }
   for (String driver : toRemove) drivers.remove(driver);
   works = unscheduled;
 }
예제 #2
0
 private String issueHttpRequest(String command, String content) {
   String url = driver.getUrl() + "/i/" + command + ".command";
   HttpClient client = this.httpClient;
   HttpPost request = prepareRequest(content, url);
   String body = null;
   try {
     HttpResponse response = client.execute(request);
     body = fetchResponseBody(response);
   } catch (SocketTimeoutException ste) {
     LOGGER.error("fail to POST driver while execute trigger");
   } catch (ConnectTimeoutException cte) {
     LOGGER.error("fail to POST driver while execute trigger");
   } catch (Exception e) {
     LOGGER.error("fail to POST driver while execute trigger");
   }
   return body; // HTTP response body retrieved
 }