
public class ExtremeTask {
	private TaskList tasklist = null;
	SeverList serverlist = main_program.serverlist_head;
	
	public ExtremeTask(TaskList tasklist)
	{
		this.tasklist = tasklist;
	}
	
	public void taskSolve()
	{
		if(isExtremetask())
		{
			serverlist =  main_program.serverlist_head;
			while(serverlist.getNext() != null)
			{
				serverlist = serverlist.getNext();
				if( serverlist.get_all_Memory() >= tasklist.get_need_Memory())
				{
					serverlist.isDispose = false;
					serverlist.importTask.add_TaskList(tasklist);
					//生成服务器自己的线程处理//分配好线程内之后恢复
					
					

					
				}
		
			}
			
		}
	}
	
	public boolean isExtremetask()
	{
		int i=0;
		int host_name = Input.server_num;
		
		
		while(serverlist.getNext() != null)
		{
			serverlist = serverlist.getNext();
			if( serverlist.get_all_Memory() >= tasklist.get_need_Memory())
			{
				i++;
			}
	
		}
		if(i > host_name/5 )
		{
			return false;
		}
		else return true;
		
	}

}
