Package sos.scheduler.command

Examples of sos.scheduler.command.SOSSchedulerCommand


    String request = "";
    String response = "";
    int counter = 0;
    int counterError = 0;   
    long timeInSec = 0;
    SOSSchedulerCommand remoteCommand = null;
       
    try {
      timeInSec = System.currentTimeMillis();
     
      checkParams();
     
      request = getRequest();
     
      remoteCommand = new SOSSchedulerCommand();
     
      remoteCommand.setProtocol(this.schedulerLauncherProtocol);
      remoteCommand.connect(this.schedulerLauncherHost, this.schedulerLauncherPort);
           
      boolean loop = true;
      terminateTimeInSec = System.currentTimeMillis() + (this.schedulerLauncherDuration * 1000);     
      sosLogger.debug("..time until termination: " + terminateTimeInSec);
      //soll so lange wiederholt werden, bis aktuelle Zeit = terminateTimeInSec erreicht hat     
      while(loop) {               
        sosLogger.info("..sending request to job scheduler [" + this.schedulerLauncherHost + ":" + this.schedulerLauncherPort + "]: " + request);
        if (System.currentTimeMillis() > this.terminateTimeInSec) {
          //Abbruchbedingungen erreicht
          sosLogger.debug("..time until termination: " + terminateTimeInSec);
          loop = false;
          break; //abbruchbedingung
        }
        //loop wird nur auf false gesetzt, wenn scheduler_launcher_duration erreicht wurde.
        for (int i =0; i < schedulerLauncherMinStarts ; i++) {               
          remoteCommand.sendRequest(request);
          counter++;
//          hier die Fehlerhandhabung
          if (this.schedulerLauncherProtocol.equalsIgnoreCase("tcp")) { // no response is returned for UDP messages
            response = remoteCommand.getResponse();
            SOSXMLXPath xpath = new SOSXMLXPath(new StringBuffer(response));
            String errCode = xpath.selectSingleNodeValue("//ERROR/@code");
            String errMessage = xpath.selectSingleNodeValue("//ERROR/@text");
            sosLogger.info("..job scheduler response: " + response);               
            if ((errCode != null && errCode.length() > 0) || (errMessage != null && errMessage.length() > 0)) {
              sosLogger.warn("..job scheduler response reports error message: " + errMessage + " [" + errCode + "]");
              counterError++;
            }
          }
        }
               
        schedulerLauncherMinStarts = this.startIncrement(schedulerLauncherMinStarts);
               
      }
      sosLogger.info("..number of jobs launched: " + counter);
      stateText = "..number of jobs launched: " + (counter) + "(error="+(counterError) ";success="+(counter - counterError) +")";
      showSummary(counter, counterError, timeInSec);
     
     
     
    } catch (Exception e) {
      stateText = "..number of jobs launched: " + (counter) + "(error=" + counterError +  ";success="+(counter - counterError) +")" + e.getMessage();
      sosLogger.info("..error in "+ SOSClassUtil.getClassName() + ": " + e.getMessage());
      throw new Exception("..error in "+ SOSClassUtil.getClassName() + ": " + e.getMessage());
     
    } finally {
      if (remoteCommand != null) { try { remoteCommand.disconnect(); } catch (Exception x) {} } // gracefully ignore this error
    }
  }
View Full Code Here


      try{
        supervisor=spooler.supervisor_client();
      } catch(Exception e){} // there is no supervisor
      String answer;
      if (host.length()>0 && port!=0){
        SOSSchedulerCommand schedulerCommand = new SOSSchedulerCommand();
        schedulerCommand.setHost(host);
        schedulerCommand.setPort(port);
        schedulerCommand.setProtocol("tcp");
        spooler_log.debug1(".. connecting to Job Scheduler " + schedulerCommand.getHost() + ":" + schedulerCommand.getPort());
              schedulerCommand.connect();
              schedulerCommand.sendRequest(xml);
              answer = schedulerCommand.getResponse();
      } else if (supervisor!=null && supervisor.hostname()!=null && supervisor.hostname().length()>0){
        SOSSchedulerCommand schedulerCommand = new SOSSchedulerCommand();
        schedulerCommand.setHost(supervisor.hostname());
        schedulerCommand.setPort(supervisor.tcp_port());
        schedulerCommand.setProtocol("tcp");
        spooler_log.debug1(".. connecting to Job Scheduler " + schedulerCommand.getHost() + ":" + schedulerCommand.getPort());
              schedulerCommand.connect();
              schedulerCommand.sendRequest(xml);
              answer = schedulerCommand.getResponse();
      }else{
        spooler_log.info("No supervisor configured, submitting event to this Job Scheduler.");
        answer = spooler.execute_xml(xml);
      }
      SOSXMLXPath xAnswer = new SOSXMLXPath(new StringBuffer(answer));
View Full Code Here

    public boolean spooler_process() {
   
        String request = "";
        String response = "";
        Variable_set parameters = null;
        SOSSchedulerCommand remoteCommand = null;
       
       
        try {

            parameters = spooler_task.params();
           
            if (spooler_job.order_queue() != null) {
                parameters.merge(spooler_task.order().params());
                this.initParameters();
                this.getTaskParameters(false);
                this.getOrderParameters(spooler_task.order().params(), true);
            }
           
           
            int oneOfUs = 0;
            oneOfUs += (this.getJobName() == null || this.getJobName().length() == 0) ? 0 : 1;
            oneOfUs += (this.getOrderId() == null || this.getOrderId().length() == 0) ? 0 : 1;
            oneOfUs += (this.getCommand() == null || this.getCommand().length() == 0) ? 0 : 1;
           
            if (oneOfUs == 0) {
                throw new Exception("one of the parameters [scheduler_remote_job, scheduler_remote_order, scheduler_remote_command] must be specified");
            } else if (oneOfUs > 1) {
                throw new Exception("one of the parameters [scheduler_remote_job, scheduler_remote_order, scheduler_remote_command] must be specified, " + oneOfUs + " were given");
            }
           
           
            if (this.getOrderId() != null && this.getOrderId().length() > 0) {
                request  = "<add_order";
                request += " replace=\"" + (this.isReplace() ? "yes" : "no") + "\"";
                if (this.getOrderId() != null && this.getOrderId().length() > 0) request += " id=\"" + this.getOrderId() + "\"";
                if (this.getAt() != null && this.getAt().length() > 0) request += " at=\"" + this.getAt() + "\"";
                if (this.getJobChain() != null && this.getJobChain().length() > 0) request += " job_chain=\"" + this.getJobChain() + "\"";
                if (this.getPriority() != null && this.getPriority().length() > 0) request += " priority=\"" + this.getPriority() + "\"";
                if (this.getState() != null && this.getState().length() > 0) request += " state=\"" + this.getState() + "\"";
                if (this.getTitle() != null && this.getTitle().length() > 0) request += " title=\"" + this.getTitle() + "\"";
                if (this.getWebService() != null && this.getWebService().length() > 0) request += " web_service=\"" + this.getWebService() + "\"";
                request += ">";
                request += "<params>";
                String[] params = parameters.names().split(";");
                for(int i=0; i<params.length; i++) {
                    if (!params[i].startsWith("scheduler_remote_")) {
                      request += "<param name=\"" + params[i] + "\" value=\"" + parameters.var(params[i]) + "\"/>";
                    }
                }
                request += "</params>";
                if (this.getRunTime() != null && this.getRunTime().length() > 0) request += this.getRunTime();
                request += "</add_order>";

            } else if (this.getJobName() != null && this.getJobName().length() > 0) {
                request  = "<start_job job=\"" + this.getJobName() + "\"";
                if (this.getAfter() != null && this.getAfter().length() > 0) request += " after=\"" + this.getAfter() + "\"";
                if (this.getAt() != null && this.getAt().length() > 0) request += " at=\"" + this.getAt() + "\"";
                if (this.getWebService() != null && this.getWebService().length() > 0) request += " web_service=\"" + this.getWebService() + "\"";
                request += ">";
                request += "<params>";
                String[] params = parameters.names().split(";");
                for(int i=0; i<params.length; i++) {
                    if (!params[i].startsWith("scheduler_remote_")) {
                        request += "<param name=\"" + params[i] + "\" value=\"" + parameters.var(params[i]) + "\"/>";
                    }
                }
                request += "</params>";
                request += "</start_job>";

            } else {
                request = this.getCommand();
            }
           
           
            remoteCommand = new SOSSchedulerCommand(this.getHost(), this.getPort(), this.getProtocol());
            remoteCommand.connect();
           

            spooler_log.info("sending request to remote Job Scheduler [" + this.getHost() + ":" + this.getPort() + "]: " + request);
            remoteCommand.sendRequest(request);
           
           
            if (this.getProtocol().equalsIgnoreCase("tcp")) { // no response is returned for UDP messages
                response = remoteCommand.getResponse();
                SOSXMLXPath xpath = new SOSXMLXPath(new StringBuffer(response));
                String errCode = xpath.selectSingleNodeValue("//ERROR/@code");
                String errMessage = xpath.selectSingleNodeValue("//ERROR/@text");
                spooler_log.info("remote job scheduler response: " + response);

                if ((errCode != null && errCode.length() > 0) || (errMessage != null && errMessage.length() > 0)) {
                    spooler_log.warn("remote Job Scheduler response reports error message: " + errMessage + " [" + errCode + "]");
                }
            }
           
            return (spooler_job.order_queue() != null);
           
        } catch (Exception e) {
            spooler_log.error("error occurred for remote execution: " + e.getMessage());
            return false;
        } finally {
            if (remoteCommand != null) { try { remoteCommand.disconnect(); } catch (Exception x) {} } // gracefully ignore this error
        }
       
    }
View Full Code Here

                    hwFile.open( eventFileCopy.getCanonicalPath());
                } else {
                    hwFile.open( this.getEventFilenamePrefix() + " " + eventFileCopy.getAbsolutePath());
                }
               
                SOSSchedulerCommand schedulerCommand = new SOSSchedulerCommand();
                schedulerCommand.setHost(this.getEventSupervisorSchedulerHost());
                schedulerCommand.setPort(this.getEventSupervisorSchedulerPort());
                schedulerCommand.setTimeout(this.getEventSupervisorSchedulerTimeout());
                schedulerCommand.connect();
               
                while (!hwFile.eof())
                {
                    Record record = hwFile.get();
                    spooler_log.info("--->" + record);
                    if (record.field_count() < 10) throw new Exception("number of fields in event file [" + eventFile.getCanonicalPath() + "] is too small: " + record.field_count());
                    eventCount++;
                    spooler_log.info("... will be processed");
                    spooler_log.info(record.string(0) + " event");
                   
                    String command = "<add_order title=\"dequeued event\" job_chain=\"" + this.getEventSupervisorSchedulerJobChainName() + "\">";
                    command += "<params>";

                    command += "<param name=\"action\"          value=\"" + getValue(record.string(0)) + "\"/>";
                    command += "<param name=\"scheduler_host\"  value=\"" + getValue(record.string(1)) + "\"/>";
                    command += "<param name=\"scheduler_port\"  value=\"" + getValue(record.string(2)) + "\"/>";
                    command += "<param name=\"job_chain\"       value=\"" + getValue(record.string(3)) + "\"/>";
                    command += "<param name=\"order_id\"        value=\"" + getValue(record.string(4)) + "\"/>";
                    command += "<param name=\"job_name\"        value=\"" + getValue(record.string(5)) + "\"/>";
                    command += "<param name=\"event_class\"     value=\"" + getValue(record.string(6)) + "\"/>";
                    command += "<param name=\"event_id\"        value=\"" + getValue(record.string(7)) + "\"/>";
                    command += "<param name=\"exit_code\"       value=\"" + getValue(record.string(8)) + "\"/>";
                    command += "<param name=\"created\"         value=\"" + getValue(record.string(9)) + "\"/>";

                    int expiration_column = 1;
                    if (record.field_count() > eventMinFieldCount) {
                        spooler_log.info("--->" + record.string(10) + " " + record.string(10).indexOf(""));
                        if (record.string(10).indexOf("=") == -1) {// Kompatibilit�tsabfrage
                           if (record.string(10) != null && record.string(10).length() > 0)
                              command += "<param name=\"expires\"        value=\"" + record.string(10) + "\"/>";
                              expiration_column = 0;
                        }
                    }
                  
                    for(int i=eventMaxFieldCount-expiration_column; i<record.field_count(); i++) {
                        int posFound = record.string(i).indexOf("=");
                        if (posFound != -1) {
                            command += "<param name=\"" + record.string(i).substring(0, posFound) + "\"        value=\"" + record.string(i).substring(posFound+1) + "\"/>";
                        }
                    }

                    command += "</params></add_order>";
                    this.getLogger().info(".. sending command to remote Job Scheduler [" + this.getEventSupervisorSchedulerHost() + ":" + this.getEventSupervisorSchedulerPort() + "]: " + command );

                    schedulerCommand.sendRequest(command);
                    SOSXMLXPath answer = new SOSXMLXPath(new StringBuffer(schedulerCommand.getResponse()));
                    String errorText = answer.selectSingleNodeValue("//ERROR/@text");
                    if (errorText != null && errorText.length() > 0) {
                        throw new Exception("could not send command to Supervisor Job Scheduler [" + this.getEventSupervisorSchedulerHost() + ":" + this.getEventSupervisorSchedulerPort() + "]: " + errorText );
                    }                           
                }

                schedulerCommand.disconnect();
                hwFile.close();
               
                if (!eventFileCopy.delete()) {
                    this.getLogger().info("could not delete temporary working copy of event file, re-trying later");
                    eventFileCopy.deleteOnExit();
View Full Code Here

  public boolean spooler_process() {
   
    String request                    = "";
    String response                   = "";
    Variable_set parameters           = null;
    SOSSchedulerCommand remoteCommand = null;
    String signalId                   = null;
    HashMap res                       = null ;
    try {           
      if (listOfSignalObject.hasNext()) {
        res = (HashMap)listOfSignalObject.next();
        parameters = spooler_task.params();
       
        //wenn scheduler_remote_host und scheduler_remote_port nicht angegeben sind, dann 
        //die Einstellungen aus der Settings lesen
        if((sosString.parseToString(getHost()).length() == 0
            || sosString.parseToString(getHost()).equalsIgnoreCase("localhost")) &&
            getPort() == 4444) {           
          SOSConnectionSettings settings = new SOSConnectionSettings(sosConnection, "SETTINGS", new SOSSchedulerLogger(this.spooler.log()));
         
          Properties section = settings.getSection(application, sectionname);
          if(sosString.parseToString(section, "scheduler.host").length() > 0){
            setHost(sosString.parseToString(section, "scheduler.host"));
            spooler_log.info(".. settings [scheduler.host]: " + this.getHost());
            //Port auslesen nur wenn host auch aus der Settingstabelle ausgelesen wurde.
            if(sosString.parseToString(section, "scheduler.port").length() > 0){
              int sPort = 0;
              try {
                sPort = Integer.parseInt(sosString.parseToString(section, "scheduler.port"));
                setPort(sPort);
                spooler_log.info(".. settings [scheduler.port]: " + this.getPort());
              } catch (Exception e) {
                spooler_log.warn("..error while reading settings[scheduler.port]: " + e.getMessage());
              }
             
            }
          }
         
         
        }
       
        signalId = sosString.parseToString(res, "signal_id");
        spooler_log.debug("..signal Id: " + signalId);
       
        request  = "<add_order";
        request += " replace=\"" + (this.isReplace() ? "yes" : "no") + "\"";                     
        if (this.getOrderId() != null && this.getOrderId().length() > 0) request += " id=\"" + this.getOrderId() + "\"";
        if (this.getAt() != null && this.getAt().length() > 0) request += " at=\"" + this.getAt() + "\"";
        if (sosString.parseToString(res, "job_chain").length() > 0) request += " job_chain=\"" + sosString.parseToString(res, "job_chain") + "\"";
        else if (this.getJobChain() != null && this.getJobChain().length() > 0request += " job_chain=\"" + this.getJobChain() + "\"";
        if (this.getPriority() != null && this.getPriority().length() > 0) request += " priority=\"" + this.getPriority() + "\"";
        if (this.getState() != null && this.getState().length() > 0) request += " state=\"" + this.getState() + "\"";        
        request += " title=\"" + (sosString.parseToString(getTitle()).length() > 0 ? getTitle()+":"+signalId  : signalId )"\"";
        if (this.getWebService() != null && this.getWebService().length() > 0) request += " web_service=\"" + this.getWebService() + "\"";
        request += ">";
        request += "<params>";
        String[] params = parameters.names().split(";");
        for(int i=0; i<params.length; i++) {
          if (!params[i].startsWith("scheduler_remote_") && !params[i].equalsIgnoreCase("sos_settings_file")) {
            request += "<param name=\"" + params[i] + "\" value=\"" + parameters.var(params[i]) + "\"/>";
          }
        }
       
        //Parameter aus der Tabelle SCHEDULER_SIGNAL_PARAMETERS             
        String selParameters = "SELECT \"NAME\", \"VALUE\", \"LONG_VALUE\" FROM " 
          + TABLE_SCHEDULER_SIGNAL_PARAMETERS+
          " WHERE \"SIGNAL_ID\" = " + signalId ;
       
        if(sosString.parseToString(res.get("operation")).length() > 0) {
          String value = sosString.parseToString(res.get("operation")).toLowerCase() ;
          request += "<param name=\"operation\" value=\"" + value+ "\"/>";
        }
       
        ArrayList listOfParams = sosConnection.getArray(selParameters);       
        for (int i =0; i < listOfParams.size(); i++) {
          HashMap h = (HashMap)listOfParams.get(i);               
          String value = (sosString.parseToString(h.get("value")).length() > 0) ? sosString.parseToString(h.get("value")) : sosString.parseToString(h.get("long_value")) ;
          request += "<param name=\"" + h.get("name") + "\" value=\"" + value+ "\"/>";
        }
       
       
        request += "</params>";
        if (this.getRunTime() != null && this.getRunTime().length() > 0) request += this.getRunTime();
        request += "</add_order>";
       
        remoteCommand = new SOSSchedulerCommand(this.getHost(), this.getPort(), this.getProtocol());
        remoteCommand.connect();
       
        spooler_log.info("sending request to remote Job Scheduler [" + this.getHost() + ":" + this.getPort() + "]: " + request);
        remoteCommand.sendRequest(request);
       
       
        if (this.getProtocol().equalsIgnoreCase("tcp")) { // no response is returned for UDP messages         
          response = remoteCommand.getResponse();         
          SOSXMLXPath xpath = new SOSXMLXPath(new StringBuffer(response));
          String errCode = xpath.selectSingleNodeValue("//ERROR/@code");
          String errMessage = xpath.selectSingleNodeValue("//ERROR/@text");
          spooler_log.info("remote job scheduler response: " + response);
         
          if ((errCode != null && errCode.length() > 0) || (errMessage != null && errMessage.length() > 0)) {
            spooler_log.warn("remote Job Scheduler response reports error message: " + errMessage + " [" + errCode + "]");
          }
        }
        //status = 1 entspricht Export-Auftrag erzeugt
        String upStr = "UPDATE "  +               
        TABLE_SCHEDULER_SIGNAL_OBECTS +
        " SET \"STATUS\" = 1 WHERE  \"SIGNAL_ID\" = " + signalId;
        sosConnection.executeUpdate(upStr);
        sosConnection.commit();
      }
     
      countProcessOk++;
      return listOfSignalObject.hasNext();
     
    } catch (Exception e) {
      countProcessError++;
      spooler_log.error("error occurred for remote execution: " + e.getMessage());
      if(sosConnection != null) {
        try {
          sosConnection.rollback();
          String upStr = "UPDATE "  +
         
          TABLE_SCHEDULER_SIGNAL_OBECTS +
          " SET \"STATUS\" = 1001 WHERE  \"SIGNAL_ID\" = " + signalId;
          sosConnection.executeUpdate(upStr);
          sosConnection.commit();
         
        } catch (Exception x) {}
       
      }
      return false;
    } finally {
      if (remoteCommand != null) {
        try { remoteCommand.disconnect(); } catch (Exception x) {}  // gracefully ignore this error
     
    }   
   
  }
View Full Code Here

                jobContent += "</params></start_job>";
               
                Iterator schedulerIterator = this.checkSchedulers.iterator();
                while(schedulerIterator.hasNext()) {
                    HashMap checkScheduler = (HashMap)schedulerIterator.next();
                    SOSSchedulerCommand command = new SOSSchedulerCommand(checkScheduler.get("host").toString(),
                                                       Integer.parseInt(checkScheduler.get("port").toString()), "udp");
                    command.connect();
                    command.sendRequest(jobContent);
                    command.disconnect();
                }
               
                // TODO wait some seconds and retrieve sanity check results from database, send alert message
               
            } catch (Exception e) {
View Full Code Here

              if (commandAttributes.item(j).getNodeName().equals("scheduler_port") && commandAttributes.item(j).getNodeValue().length() > 0)
                commandPort = commandAttributes.item(j).getNodeValue();
              if (commandAttributes.item(j).getNodeName().equals("protocol") && commandAttributes.item(j).getNodeValue().length() > 0)
                commandProtocol = commandAttributes.item(j).getNodeValue();
            }
            SOSSchedulerCommand schedulerCommand = new SOSSchedulerCommand();
            schedulerCommand.setTimeout(socket_timeout);
            /*if (commandSchedulerID.length() > 0) {
               // TODO: fetch remote Job Schedulers via XML response <show_state what="remote_schedulers"/>  
               // <answer><remote_schedulers><remote_scheduler ip="" tcp_port="" scheduler_id=""/></remote_schedulers></answer>
            } else*/
            if (commandHost.length() > 0) {
              schedulerCommand.setHost(commandHost);
              if (commandPort.length() > 0) {
                schedulerCommand.setPort(Integer.parseInt(commandPort));
              }
              else {
                throw new Exception("empty port has been specified by event handler response for commands");
              }
            }
            else {
              throw new Exception("empty Job Scheduler ID or host and port have been specified by event handler response for commands");
            }
            if (commandProtocol.length() > 0)
              schedulerCommand.setProtocol(commandProtocol);
            try {
              this.getLogger().debug1(".. connecting to Job Scheduler " + schedulerCommand.getHost() + ":" + schedulerCommand.getPort());
              schedulerCommand.connect();
              NodeList commandElements = command.getChildNodes();
              for (int k = 0; k < commandElements.getLength(); k++) {
                if (commandElements.item(k).getNodeType() != Node.ELEMENT_NODE)
                  continue;
                String commandRequest = this.xmlNodeToString(commandElements.item(k));
                this.getLogger()
                    .info(".. sending command to remote Job Scheduler [" + commandHost + ":" + commandPort + "]: " + commandRequest);
                schedulerCommand.sendRequest(commandRequest);
                SOSXMLXPath answer = new SOSXMLXPath(new StringBuffer(schedulerCommand.getResponse()));
                String errorText = answer.selectSingleNodeValue("//ERROR/@text");
                if (errorText != null && errorText.length() > 0) {
                  throw new Exception("could not send command to remote Job Scheduler [" + commandHost + ":" + commandPort + "]: "
                      + errorText);
                }
              }
            }
            catch (Exception e) {
              throw new Exception("Error contacting remote Job Scheduler: " + e, e);
            }
            finally {
              try {
                schedulerCommand.disconnect();
              }
              catch (Exception ex) {
              }
            }
          }
View Full Code Here

      if (hostPort!=null){
        String[] aHostPort=hostPort.split(":");
        String host=aHostPort[0];
        String port="";
        int iPort=0;
        SOSSchedulerCommand command;
        if(aHostPort.length>1) {
          port=aHostPort[1];
          try{
            iPort=Integer.parseInt(port);
          } catch (Exception e){
           
          }         
        }
        if (iPort>0) command = new SOSSchedulerCommand(host, iPort);
        else command = new SOSSchedulerCommand(host);
        try{
          command.connect();         
          command.sendRequest("<show_state/>");
          String response = command.getResponse().trim();
          getLogger().debug6("Response from Job Scheduler: "+response);
         
          Document spoolerDocument = docBuilder.parse(new ByteArrayInputStream(response.getBytes()));
          Element spoolerElement = spoolerDocument.getDocumentElement();
          Node answerNode = spoolerElement.getFirstChild();
          while( answerNode != null  &&  answerNode.getNodeType() != Node.ELEMENT_NODE ) answerNode = answerNode.getNextSibling();
         
              if ( answerNode == null ) {
                  throw new Exception("answer contains no xml elements");
              }
             
              Element answerElement = (Element)answerNode;     
              NodeList jobs = answerElement.getElementsByTagName("job");
              if (jobs!=null && jobs.getLength()>0){
                for (int i=0;i<jobs.getLength();i++){
                  Node jobNode = jobs.item(i);
                    if (jobNode!=null && jobNode.getNodeType()==Node.ELEMENT_NODE){
                      Element jobElement = (Element) jobNode;
                      String state = jobElement.getAttribute("state");
                      String jobName = jobElement.getAttribute("job");
                      if (state.equalsIgnoreCase("stopped")){
                       
                        getLogger().warn("Job "+jobName+" on Job Scheduler \""+hostPort+"\" is stopped.");
                      }
                      if (state.equalsIgnoreCase("enqueued")){
                        getLogger().info("Job "+jobName+" on Job Scheduler \""+hostPort+"\" is enqueued.");
                      }
                    }
                }
              }
        }catch (Exception e){
          getLogger().warn("Error occured querying Job Scheduler at\""+hostPort+"\": "+e);
        } finally{
          try {
            command.disconnect();
          } catch (Exception ex){}
        }
       
      }
    }
View Full Code Here

    xml += "</params></add_order>";
    executeXml(host_, port_, xml);
  }

  private void executeXml(String host_, int port_, String xml) throws Exception {
    SOSSchedulerCommand command;
    command = new SOSSchedulerCommand(host_, port_);
    command.setProtocol("udp");
    sosLogger.debug3("Trying connection to " + host_ + ":" + port_);
    command.connect();
    sosLogger.debug3("...connected");
    sosLogger.debug3("Sending add_order command:\n" + xml);
    command.sendRequest(xml);
  }
View Full Code Here

    return erg;
   }
  
   private String sendCommand(String command) {
     String s="";
    SOSSchedulerCommand socket=null;
      try {
       
         socket = new SOSSchedulerCommand();
             socket.connect(this.host, this.port)
           socket.sendRequest(command);
           s = socket.getResponse();
      
       } catch(Exception ee) {
          System.out.println("Error sending Command" + ee.getMessage());
      
      } finally {
         if( socket != null)
       try {
       socket.disconnect();
       } catch (Exception e1) {
        e1.printStackTrace();
       }

      }
View Full Code Here

TOP

Related Classes of sos.scheduler.command.SOSSchedulerCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.