Examples of Process


Examples of org.rzo.yajsw.os.Process

  }

  private String getCurrentJava()
  {
    int myPid = OperatingSystem.instance().processManagerInstance().currentProcessId();
    Process myProcess = OperatingSystem.instance().processManagerInstance().getProcess(myPid);
    String cmd = myProcess.getCommand();
    String jvm = null;
    if (cmd.startsWith("\""))
      jvm = cmd.substring(0, cmd.indexOf("\" ") + 1);
    else
      jvm = cmd.substring(0, cmd.indexOf(" "));
View Full Code Here

Examples of org.rzo.yajsw.os.Process

    String count = "" + _process.getRestartCount();
    String pid = "" + _process.getAppPid();
    String exitCode = "" + _process.getExitCode();
    try
    {
      Process p = OperatingSystem.instance().processManagerInstance().createProcess();
      p.setCommand(getScript() + " " + id + " " + state + " " + count + " " + pid + " " + exitCode);
      p.setPipeStreams(false, false);
      p.start();
      p.waitFor(getTimeout());
      if (p.isRunning())
        p.kill(999);
      if (p.getExitCode() != 0)
        System.out.println("script " + getScript() + "returned " + p.getExitCode());
      p.destroy();
    }
    catch (Exception ex)
    {
      ex.printStackTrace();
    }
View Full Code Here

Examples of org.rzo.yajsw.os.Process

    System.exit(-1);
  }

  public static void generate(int pid, File input, File output)
  {
    Process p = OperatingSystem.instance().processManagerInstance().getProcess(pid);
    if (p == null)
    {
      System.out.println("cannot find process " + pid);
      return;
    }
    String cmd = p.getCommand().trim();
    if (cmd == null)
    {
      System.out.println("cannot get command line of process");
      return;
    }
View Full Code Here

Examples of org.rzo.yajsw.os.Process

    {
        for (Integer pp :  pids)
          {
          if (pp != pid)
          {
           Process ppp = OperatingSystem.instance().processManagerInstance().getProcess(pp);
           if (ppp == null)
           {
             System.out.println("no access right to pid "+pp);
             continue;
           }
           if (ppp.getCommand().trim().endsWith("Main")||ppp.getCommand().trim().endsWith("Main\""))
             result = pp;
          }
    }
  }
    return result;
View Full Code Here

Examples of org.rzo.yajsw.os.Process

  {
    Map<String, ServiceInfo> result = new HashMap<String, ServiceInfo>();
    Map<Integer, Integer> processes = WindowsXPProcess.getProcessMaps(0)[0];
    for (Integer pid : processes.keySet())
    {
      Process p = _processes.get(pid);
      if (p == null)
      {
        p = WindowsXPProcess.getProcess(pid);
        if (p == null)
          continue;
        _processes.put(pid, p);
      }
      String cmd = p.getCommand();
      if (cmd != null && cmd.contains("wrapper.jar\" -c"))
      {
        JCLParser jp = JCLParser.parse(cmd);
        ServiceInfoImpl service = new ServiceInfoImpl();
        service.setCommand(cmd);
        String confFile = jp.getArgs().get(1);
        if (confFile == null)
          continue;
        File f = new File(confFile);
        if (!f.exists())
          f = new File(p.getWorkingDir(), confFile);
        service.setDisplayName(f.getAbsolutePath());
        service.setName(jp.getArgs().get(1));
        service.setPid(pid);
        service.setWrapperAppPid(getAppPid(pid));
        service.setAccount(p.getUser());
        result.put(service.getName(), service);
      }
      Set<Integer> newPids = new HashSet<Integer>(processes.keySet());
      Set<Integer> toRemove = new HashSet<Integer>(_processes.keySet());
      toRemove.removeAll(newPids);
View Full Code Here

Examples of org.rzo.yajsw.os.Process

  {
    AbstractWrappedProcessMBean  proxy = null;
    try
    {
    String config = name;
    Process p = _processes.get(_services.get(name).getPid());
    File f = new File(p.getWorkingDir(), config);
    if (!f.exists())
    {
      System.out.println("file not found "+f.getAbsolutePath());
      //return null;
    }
View Full Code Here

Examples of org.rzo.yajsw.os.Process

  }

  private String getCurrentJava()
  {
    int myPid = OperatingSystem.instance().processManagerInstance().currentProcessId();
    Process myProcess = OperatingSystem.instance().processManagerInstance().getProcess(myPid);
    String cmd = myProcess.getCommand();
    String jvm = null;
    if (cmd.startsWith("\""))
      jvm = cmd.substring(0, cmd.indexOf("\" ") + 1);
    else
      jvm = cmd.substring(0, cmd.indexOf(" "));
View Full Code Here

Examples of org.vbs.cqpm.core.Process

      logger.error("Thread error: " + e.getMessage());
  }

  // Test process failed status
  ProcessCheckTask task1 = processCheckTaskList.get(2);
  Process proc1 = task1.getProcess();

  assertTrue("Process should has failed.", proc1.failed() == true);
    }
View Full Code Here

Examples of ru.vassaev.core.thread.Process

  public State process(Context cntx) throws TaskException, SysException,
      InterruptedException {
    State st = paramsValidateAndPrepare(cntx);
    if (st != null)
      return st;
    Process prc = Process.currentProcess();
    FindStringStream fss = new FindStringStream();
    fss.add("<%prm.", Prm.class);
    fss.add("%>", End.class);
    fss.setOutSkipped(true);
    // //////
    FileInputStream fis = null;
    java.io.InputStreamReader isr = null;
    try {
      if (source instanceof File) {
        try {
          fis = new FileInputStream(((File) source).getCanonicalPath());
          prc.regResource(fis);
          isr = new java.io.InputStreamReader(fis, "utf-8");
          prc.regResource(isr);
        } catch (FileNotFoundException e) {
          throw new TaskException(State.DONE_ERR, e);
        } catch (UnsupportedEncodingException e) {
          try {
            fis.close();
          } catch (IOException e1) {
            e1.printStackTrace();
          }
          throw new TaskException(State.DONE_ERR, e);
        } catch (IOException e) {
          try {
            fis.close();
          } catch (IOException e1) {
            e1.printStackTrace();
          }
          throw new TaskException(State.DONE_ERR, e);
        }
      }
      StringBuffer sb = new StringBuffer();
      prc.regResourceName(sb, "msg.full");
      int ch;
      Object r;
      Object prev = null;
      Object o = null;
      try {
        while ((ch = isr.read()) != -1) {
          fss.write((char) ch);
          if (fss.available() > 0)
            while ((r = fss.readObject()) != null) {
              if (r instanceof Skipped) {
                if ((prev != null) && (prev instanceof Prm)) {
                  ((Prm) prev).name = r.toString();
                  try {
                    o = cntx.getPrmByFullName(((Prm) prev).name);
                  } catch(Throwable e) {
                    o = e.getMessage();
                  }
                  String v = o.toString();
                  prc.regResourceName(v, "msg.part");
                  if (!Null.equ(v))
                    sb.append(v);
                  prev = null;
                } else {
                  String v = ((Skipped) r).getValue();
                  prc.regResourceName(v, "msg.part");
                  if (!Null.equ(v))
                    sb.append(v);
                }
                cntx.getPrmByFullName("update");
              } else if (r instanceof Prm) {
                prev = r;
                // System.out.println(r.toString() + "\t=\t" + r.getClass());
              } else {
                prev = null;
              }
            }
        }
        fss.write(FindStringStream.EOF);

        if (fss.available() > 0)
          while ((r = fss.readObject()) != null)
            if (r instanceof Skipped) {
              if ((prev != null) && (prev instanceof Prm)) {
                ((Prm) prev).name = r.toString();
                try {
                  o = cntx.getPrmByFullName(((Prm) prev).name);
                } catch(Throwable e) {
                  o = e.getMessage();
                }
                String v = o.toString();
                prc.regResourceName(v, "msg.part");
                if (!Null.equ(v))
                  sb.append(v);
                prev = null;
              } else {
                String v = ((Skipped) r).getValue();
                prc.regResourceName(v, "msg.part");
                if (!Null.equ(v))
                  sb.append(v);
              }
              cntx.getPrmByFullName("update");
            } else if (r instanceof Prm) {
View Full Code Here

Examples of winterwell.utils.Process

      assert temp1.exists();

      // 1. Render HTML to PDF with wkhtmltopdf
      // The horrendous 7 second delay is to allow time for ajax to run,
      // even on a busy server (2 seconds was too little on egan).
      Process p = new Process("wkhtmltopdf "
          + (waitFor == null ? "" : waitFor) + " "
          + temp1.getAbsolutePath() + " " + file.getAbsolutePath());
      p.setEcho(true);
      p.run();
      int done = p.waitFor(TUnit.MINUTE.getMillisecs());

      if (!file.exists())
        throw new IOException("Failed to create " + file + "\t"
            + p.getError());
      if (p.getOutput().contains("cannot connect to X server")
          || p.getError().contains("cannot connect to X server"))
        throw new IOException(
            "render failed: wkhtmltopdf couldn't connect to an X server");
      // debug spew
      Log.report("html",
          "RenderToPdf: " + p.getOutput() + "\t" + p.getError(),
          Level.FINE);
    } catch (Exception e) {
      throw Utils.runtime(e);
    } finally {
      // clean up
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.