Package com.ytec.jdap.model

Examples of com.ytec.jdap.model.ProcessInfo


        String appId = (String) dataModel.getValueAt(row, 1);
        String appName = (String) table.getValueAt(row, 2);
        try {
          Application application = ConfigMamager.getReader().getAppById(appId);
          if (column == 2) {// ���
            ProcessInfo info = ProcessTookit.getIProcessManager().getProcessInfo(appId);
            if (info != null && !info.isWatching() && Application.RUNNING.equals(application.getState())) {// ��ֹͨ��Ӧ�ô򿪶����������
              new MonitorFrame(appId, appName);
              info.setWatching(true);
            }
          } else if (column == 4) {// ����
            mainFrame.publishFrame(mainFrame, appId);
          } else if (column == 5) {// ֹͣ
            if (Application.STOPED.equals(application.getState())) {
View Full Code Here


    this.frame = frame;
  }
  @Override
  public void run() {
    try {
      ProcessInfo info = new ProcessInfo();
      do {
        info = ProcessTookit.getIProcessManager().getProcessInfo(frame.appId);
        if(info.getAppId() !=null){
          frame.pid = info.getPid();
          frame.timeField.setText(info.getStartTime());
          frame.memField.setText(info.getMemory());
          frame.portField.setText(info.getPort());
          frame.idField.setText(info.getPid());
          frame.repaint();
          Thread.sleep(1000);
        }else {
          break ;
        }
      } while (frame != null && frame.pid != null);
      if (frame != null)
        frame.dispose();
      info.setWatching(false);//���ü�ش���״̬
    catch (Exception e) {
    }
  }
View Full Code Here

   
        this.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        thread.setFrame(null);
        try {
          ProcessInfo info = ProcessTookit.getIProcessManager().getProcessInfo(appId);
         
          if(info !=null){//����Ϊû�򿪼�ش���
            info.setWatching(false);
          }
        } catch (Exception e1) {
          alert(e1.getMessage());
        }
            }
View Full Code Here

   *
   * @see
   * com.ytec.jdap.process.IProcessManager#getPIDByAppId(java.lang.String)
   */
  public String getPIDByAppId(String appId) throws Exception {
    ProcessInfo process = Global.AppProcess.get(appId);
    if (process != null) {
      return process.getPid();
    }
    return null;
  }
View Full Code Here

   * @see
   * com.ytec.jdap.process.IProcessManager#getProcessInfo(java.lang.String)
   */
  @Override
  public ProcessInfo getProcessInfo(String appId) throws Exception {
    ProcessInfo info = Global.AppProcess.get(appId);
    if (info != null) {
      info.setCpu(this.getCPUByPID(info.getPid()));
      info.setMemory(this.getMemByPID(info.getPid()));
      info.setPort(this.getPortByPID(info.getPid()));
    } else {
      return new ProcessInfo();
    }
    return info;
  }
View Full Code Here

        this.setAppJavaHome(app);// ����JAVA_HOME
        List<String> allList = ProcessTookit.getIProcessManager().getPIDByName(Constants.SERVER_RUN_TYPE_JAVAW + Constants.EXE);

        String cmdCommand = ProcessTookit.getIProcessManager().getCommand(app);
        Process process = Runtime.getRuntime().exec(cmdCommand);
        ProcessInfo info = new ProcessInfo();
        info.setProcess(process);
        info.setStartTime(TimeUtil.getCurDateTime());

        Thread.sleep(1000);
        List<String> newList = ProcessTookit.getIProcessManager().getPIDByName(Constants.SERVER_RUN_TYPE_JAVAW + Constants.EXE);
        newList.removeAll(allList);

        FileUtil.remove(Global.batPath + File.separator + app.getId() + Constants.APP_BAT_TYPE);// ɾ����ʱ�ű�
        if (newList.size() == 0) {
          throw new Exception("�޷�����!");
        } else {
          info.setPid(newList.get(0));
          info.setAppId(app.getId());
          Global.AppProcess.put(app.getId(), info);
          app.setState(Application.RUNNING);
        }
        ConfigMamager.getReader().modifyApp(app);
      }
View Full Code Here

   * )
   */
  public synchronized void stopApp(Application app) throws Exception {
    if (Global.AppProcess.containsKey(app.getId())) {
      try {
        ProcessInfo p = Global.AppProcess.get(app.getId());
        p.getProcess().destroy();
        app.setState(Application.STOPED);
        if (StringUtil.isNotBlank(p.getPid())) {
          ProcessTookit.getIProcessManager().killProcess(p.getPid());
        }
        Global.AppProcess.remove(app.getId());
      } catch (Exception e) {
        throw new Exception("Ӧ��[" + app.getName() + "]ֹͣ����" + e.getMessage());
      }
View Full Code Here

TOP

Related Classes of com.ytec.jdap.model.ProcessInfo

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.