📄 jobqueue.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: JobQueue.java
package cisco.dsbu.cms.boot.internal.jobq;
import java.util.LinkedList;
import java.util.List;
// Referenced classes of package cisco.dsbu.cms.boot.internal.jobq:
// Job, JobThread, JobOwner
public class JobQueue
{
private JobOwner owner;
private int maxHandlers;
private int numHandlers;
private List queue;
public JobQueue(JobOwner jobowner, int i)
{
queue = new LinkedList();
owner = jobowner;
maxHandlers = i;
}
public synchronized void submit(Object obj, boolean flag)
{
Job job = new Job(obj, flag);
queue.add(job);
triggerHandler();
if(!flag)
return;
while(!job.isCompleted())
try
{
wait();
}
catch(InterruptedException interruptedexception) { }
}
public synchronized void waitForCompletion()
{
while(!queue.isEmpty() || numHandlers != 0)
try
{
wait();
}
catch(InterruptedException interruptedexception) { }
}
synchronized Job fetch()
{
if(queue.isEmpty())
return null;
else
return (Job)queue.remove(0);
}
synchronized void handlerEnding(JobThread jobthread)
{
numHandlers--;
if(numHandlers == 0)
notifyAll();
}
private synchronized void triggerHandler()
{
if(queue.isEmpty())
return;
if(maxHandlers > 0 && numHandlers >= maxHandlers)
return;
try
{
JobHandler jobhandler = owner.createHandler(this);
JobThread jobthread = new JobThread(this, jobhandler);
numHandlers++;
jobthread.start();
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -