⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainprocess.java.svn-base

📁 通讯采集软件
💻 SVN-BASE
字号:
package pbs.application.iiop.GUI;

import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import pbs.service.struct.*;
import pbs.service.vo.*;
import pbs.service.function.*;
import pbs.application.iiop.GUI.huadong.*;

public class MainProcess
    extends Thread {
  static ProcessHD HD = new ProcessHD();
  process_info pinfo = null;
  processFunc pfunc = null;
  static int debug_no = 121;

  public static void sleep(int second) {
    try {
      Thread.sleep(1000 * second);
    }
    catch (InterruptedException ie) {
      processDebug.writeDebug(100, "sleep in validateProcess #1");
    }
  }

  public MainProcess() {
  }

  public static void main(String[] args) {
    Collection params = null;
    Iterator it = null;
    ParamModify pm = null;
    System.out.println("11111111111");
    CommGui m_CommGui = new CommGui();
    CommBuffer.m_CommGui = m_CommGui;
    CommBuffer.m_CommGui.show();
    System.out.println("22222222222");
    if (!HD.isAlive()) {
      System.out.println("HD is not Alive");
      HD = new ProcessHD();
      HD.start();
      System.out.println("调用了HD.start()");
      MainProcess m_MainProcess = new MainProcess();
      m_MainProcess.init();
      m_MainProcess.start();
    }
  }

  public int init() {
    pfunc = new processFunc(debug_no);
    pinfo = (new processFunc(debug_no)).getProcessInfo("huadong"); //华东转发process_name
    double factor = Math.random();
    pfunc.setProcessInfoStartTime(pinfo,commonFunc.getCurTime());
    System.out.println("   开始进程监测: "+this.getTimeStr(commonFunc.getCurTime()));
    return 1;
  }

  public void run() {
    try {
      while (true) {
        pfunc.setProcessInfoLastRefreshTime(pinfo, commonFunc.getCurTime());
        pfunc.updateProcessInfo(pinfo);
        System.out.println("   进程检测时间: " + this.getTimeStr(commonFunc.getCurTime()));
        try {
          try {
            Thread.sleep(60 * 1000 * 5); //五分钟监测一次
          }
          catch (Exception ee) {
            System.out.println("error while Thread.sleep()");
          }
        }
        catch (Exception ee) {
          System.out.println("error while Thread.sleep()");
        }
      }
    }
    catch (Exception ee) {
      ee.printStackTrace();
    }
  }

  public static String getTimeStr(long time) {//秒
    try {
      if (time > 0) {
        Date m_date = new java.util.Date(time*1000);
        int year = m_date.getYear();
        int month = m_date.getMonth() + 1;
        int date = m_date.getDate();
        int hour = m_date.getHours();
        int min = m_date.getMinutes();
        int sec = m_date.getSeconds();

        m_date = null;

        StringBuffer string = new StringBuffer("");

        Integer integer = new Integer(year + 1900);
        string.append(integer.toString());
        string.append("年");
        integer = new Integer(month);
        string.append(integer.toString());
        string.append("月");
        integer = new Integer(date);
        string.append(integer.toString());
        string.append("日");
        integer = new Integer(hour);
        string.append(integer.toString());
        string.append("时");
        integer = new Integer(min);
        string.append(integer.toString());
        string.append("分");
        integer = new Integer(sec);
        string.append(integer.toString());
        string.append("秒");

        return string.toString();
      }
      else {
        return "未定";
      }
    }
    catch (Exception exception) {
      return " ##";
    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -