jlocaltaskqueue.java
来自「JAMPACK Grid programming」· Java 代码 · 共 51 行
JAVA
51 行
/**
*
* Program : JTaskQueue.java
*
* Author : Vijayakrishnan Menon
*
* Date : 22nd Dec 2005
*
* Organization : Centre for Excellence in Computational Engineering and Networking (CEN)
* Amrita Viswa Vidyapeetham
*
**/
package JAMPack;
/** The local Taskqueue is a schedule queue for the local seeded user tasks, when
* ever a task is posted it is inserted into the local schedule queue that can */
public class JLocalTaskQueue {
public static final int MAX_NO_SEED_TASKS = 5;
protected static java.util.Vector<JProcess> _taskQueue = new java .util.Vector<JProcess>(JLocalTaskQueue.MAX_NO_SEED_TASKS);
protected static boolean _isFull = false;
public static boolean addTask(JProcess task) {
if(_isFull){
return false;
}
synchronized(JLocalTaskQueue._taskQueue) {
if(_taskQueue.size() > JLocalTaskQueue.MAX_NO_SEED_TASKS){
JLocalTaskQueue._isFull = true;
return false;
}
_taskQueue.add(task);
}
return true;
}
public static boolean removeTask(JProcess task) {
if(_taskQueue.isEmpty()) return false;
synchronized(JLocalTaskQueue._taskQueue) {
return _taskQueue.remove(task);
}
}
public static boolean isTaskQueueFull(){
return _isFull;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?