Package com.sun.corba.ee.impl.threadpool
Class WorkQueueImpl
- java.lang.Object
-
- com.sun.corba.ee.impl.threadpool.WorkQueueImpl
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
name
private java.util.Queue<Work>
queue
private long
totalTimeInQueue
private ThreadPool
workerThreadPool
private long
workItemsAdded
private long
workItemsDequeued
static java.lang.String
WORKQUEUE_DEFAULT_NAME
-
Constructor Summary
Constructors Constructor Description WorkQueueImpl()
WorkQueueImpl(ThreadPool workerThreadPool)
WorkQueueImpl(ThreadPool workerThreadPool, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWork(Work work)
This method is used to add work to the WorkQueuelong
averageTimeInQueue()
Returns the average amount Work items have spent in the Queue waiting to be processed.java.lang.String
getName()
This method will return the name of the WorkQueue.ThreadPool
getThreadPool()
Get the ThreadPool instance servicing this WorkQueueprivate int
getWorkQueueSize()
(package private) Work
requestWork(long waitTime)
void
setThreadPool(ThreadPool workerThreadPool)
Set the ThreadPool instance servicing this WorkQueuelong
totalWorkItemsAdded()
Returns the total number of Work items added to the Queue.int
workItemsInQueue()
Returns the total number of Work items in the Queue to be processed.
-
-
-
Field Detail
-
WORKQUEUE_DEFAULT_NAME
public static final java.lang.String WORKQUEUE_DEFAULT_NAME
- See Also:
- Constant Field Values
-
queue
private final java.util.Queue<Work> queue
-
workerThreadPool
private ThreadPool workerThreadPool
-
workItemsAdded
private long workItemsAdded
-
workItemsDequeued
private long workItemsDequeued
-
totalTimeInQueue
private long totalTimeInQueue
-
name
private final java.lang.String name
-
-
Constructor Detail
-
WorkQueueImpl
public WorkQueueImpl()
-
WorkQueueImpl
public WorkQueueImpl(ThreadPool workerThreadPool)
-
WorkQueueImpl
public WorkQueueImpl(ThreadPool workerThreadPool, java.lang.String name)
-
-
Method Detail
-
getWorkQueueSize
private int getWorkQueueSize()
-
addWork
public void addWork(Work work)
Description copied from interface:WorkQueue
This method is used to add work to the WorkQueue
-
requestWork
Work requestWork(long waitTime) throws WorkerThreadNotNeededException, java.lang.InterruptedException
- Throws:
WorkerThreadNotNeededException
java.lang.InterruptedException
-
setThreadPool
public void setThreadPool(ThreadPool workerThreadPool)
Description copied from interface:WorkQueue
Set the ThreadPool instance servicing this WorkQueue- Specified by:
setThreadPool
in interfaceWorkQueue
-
getThreadPool
public ThreadPool getThreadPool()
Description copied from interface:WorkQueue
Get the ThreadPool instance servicing this WorkQueue- Specified by:
getThreadPool
in interfaceWorkQueue
-
totalWorkItemsAdded
@ManagedAttribute @Description("Total number of items added to the queue") public long totalWorkItemsAdded()
Returns the total number of Work items added to the Queue.- Specified by:
totalWorkItemsAdded
in interfaceWorkQueue
-
workItemsInQueue
@ManagedAttribute @Description("Total number of items in the queue to be processed") public int workItemsInQueue()
Returns the total number of Work items in the Queue to be processed.- Specified by:
workItemsInQueue
in interfaceWorkQueue
-
averageTimeInQueue
@ManagedAttribute @Description("Average time work items spend waiting in the queue in milliseconds") public long averageTimeInQueue()
Returns the average amount Work items have spent in the Queue waiting to be processed.- Specified by:
averageTimeInQueue
in interfaceWorkQueue
-
-