📄 resmonitortaskarray.java
字号:
package org.osu.ogsa.stream.util;import java.io.*;import java.nio.*;import java.nio.channels.*;import java.nio.channels.spi.*;import java.nio.charset.*;import java.net.*;import java.util.*;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;//I should change inArray to HashTable class if I have a spare!!!!public class ResMonitorTaskArray { private static Log log = LogFactory.getLog(ResMonitorTaskArray.class.getName());// private ResMonitorTask []taskArray = new ResMonitorTask[DefConstants.MAX_NUM_OUT_BUFFER]; private Hashtable hashTasks = null; private MonitorNotification monitor = null; public void wakeupMonitorTask(String strNeighborHandle) { } public void haltMonitorTask(String strNeighborMonitorHandle) { ResMonitorTask resMonitor; if(hashTasks.containsKey(strNeighborMonitorHandle)) { resMonitor = (ResMonitorTask)(hashTasks.get(strNeighborMonitorHandle)); resMonitor.halt(); } } public int howmanyTasks() { return hashTasks.size(); } public ResMonitorTaskArray(MonitorNotification monNot) { hashTasks = new Hashtable(DefConstants.MAX_NUM_OUT_BUFFER); monitor = monNot; } public ResMonitorTask addMonitorTask(SimConnectionContext context) { if(context == null) { log.error("the connect context can't be null"); return null; } if(context.strNeighborMonitorHandle == null) { log.warn("have to set the values of the moniotr neighbor's handle"); return null; } if(hashTasks.containsKey(context.strNeighborMonitorHandle)) return (ResMonitorTask)(hashTasks.get(context.strNeighborMonitorHandle)); ResMonitorTask task = new ResMonitorTask(); //Setup the connection context, and pass //the context object to task context.monitor = this.monitor; task.setConnectionContext(context); hashTasks.put(context.strNeighborMonitorHandle, (Object)task); ///////////////////////////////////// //Note: after start(), a thread will be generated automatically task.start(); return task; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -