apploadmanagerimpl.java

来自「中兴公司在parlayx开发方面的培训文档」· Java 代码 · 共 70 行

JAVA
70
字号
package samples.fw;

public class AppLoadManagerImpl 
	extends org.csapi.fw.fw_application.integrity.IpAppLoadManagerPOA
{
	java.util.Date startTime;
	java.util.Date stopTime;
	boolean toFwSuspended = false;
	java.text.SimpleDateFormat dFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");

	public AppLoadManagerImpl(){}

	public void queryAppLoadReq(org.csapi.TpTimeInterval timeInterval)
    {
		try{
	        startTime =  dFormat.parse(timeInterval.StartTime);
	        stopTime =  dFormat.parse(timeInterval.StopTime);
		}catch(Exception e){
		}
		java.util.TimerTask loadResTask = (new java.util.TimerTask() {
                          public void run()
                          {
                              if (toFwSuspended) return;
                              if (stopTime.getTime()<=System.currentTimeMillis())
                              {
                                      cancel();
                                      return;
                              }
                              //o/w gather and report the load statistics
                              // need to be defined
                              TpLoadStatistic[] loadStatistics = new TpLoadStatistic[0];
                              /*
  public org.csapi.fw.TpLoadStatisticEntityID LoadStatisticEntityID = null;
  public String TimeStamp = null;
  public org.csapi.fw.TpLoadStatisticInfo LoadStatisticInfo = null;
  // info
  private org.csapi.fw.TpLoadStatisticData ___LoadStatisticData;
  private org.csapi.fw.TpLoadStatisticError ___LoadStatisticError;
  private org.csapi.fw.TpLoadStatisticInfoType __discriminator;
                              */
                              try
                              {
                                      AppFWImpl.ipLoadManager.queryAppLoadRes(loadStatistics);
                              }catch(Exception e)
                              {
                              }

                          }
                      });
                // FOR Now, just hard code to report load for every 5 second.
                AppFWImpl.timer.schedule(loadResTask,startTime,5000);
        }

        // fw will only call this when we call to ipLoadManager.queryLoadReq
        // since we did not call, so we not do need to handle this method.
	public void queryLoadRes(org.csapi.fw.TpLoadStatistic[] loadStatistics)
    {
    }

        // fw will only call this when we call to ipLoadManager.queryLoadReq
        // since we did not call, so we not do need to handle this method.
	public void queryLoadErr (org.csapi.fw.TpLoadStatisticError loadStatisticsError){}

	public void loadLevelNotification (org.csapi.fw.TpLoadStatistic[] loadStatistics)
    {
    }

	public void resumeNotification() {toFwSuspended = true;}
	public void suspendNotification(){toFwSuspended = false;}
}

⌨️ 快捷键说明

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