📄 pasvtaskdaemon2.java
字号:
package com.ict.netcom2.kernel;
import java.io.Serializable;
import java.util.*;
import com.ict.netcom2.message.*;
import com.ict.netcom2.net.*;
import com.ict.netcom2.task.*;
import com.ict.netcom2.result.*;
public class PasvTaskDaemon2 implements Serializable{
private Timer timer;
private TaskManager tm;
private ResultManager2 rm;
private Communicator2 comm;
public PasvTaskDaemon2(TaskManager tm, Communicator2 comm,
ResultManager2 rm, int period) {
this.tm = tm;
this.rm = rm;
this.comm = comm;
timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
runTask();
}
}, 0, period*1000);
}
private void runTask() {
System.out.println("runTask() start.");
TaskInfo taskInfo;
// Query for RUNNING list of the probe
QueryTaskRep rep = comm.queryTask(2);
// warning: taskNum is type u_int.
for (int i=0; i<rep.taskNum; i++) {
taskInfo = rep.tasks.get(i);
if (taskInfo.taskType == TaskType.PASSIVE_ETH) {
Task task = tm.getTask(taskInfo.taskId);
GetResultAck ack = comm.getResult(task);
rm.storeResult(ack);
}
else if(taskInfo.taskType == TaskType.PASSIVE_ATM) {
//TODO
}
}
}
public static void main(String[] args) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -