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

📄 jlocaltaskqueue.java

📁 JAMPACK Grid programming
💻 JAVA
字号:
/**
 *
 * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -