sjt.mgmt
Class LinkedListWorkGroup
java.lang.Object
|
+--sjt.mgmt.LinkedListWorkGroup
- All Implemented Interfaces:
- WorkGroup
- public class LinkedListWorkGroup
- extends java.lang.Object
- implements WorkGroup
This is implementation of the WorkGroup interface. In this case, the implementation is
based on a java.util.LinkedList. As a FIFO type structure, the work is added to the bottom
of the list, and removed from the top.
Currently, no work load throttling is provided, meaning there is no mechanism to prevent the
linked list from growing and growing and blowing memory. This defies one of the main points of
thread management. Work load throttling will be added soon.
- Since:
- SJT 0.1
Method Summary |
void |
addWork(java.lang.Object work)
Add work to the wrapped collection. |
boolean |
isEmpty()
Check whether work has one or more work items in collection. |
java.lang.Object |
removeWork()
Remove work from the wrapped collection.The collection itself will decide whether this is
FIFO, LIFO, and any other necessary ordering. |
int |
size()
Check how many items in work collection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LinkedListWorkGroup
public LinkedListWorkGroup()
addWork
public void addWork(java.lang.Object work)
- Add work to the wrapped collection.
- Specified by:
addWork
in interface WorkGroup
- Parameters:
work
- A simple of complex work object containing payload, timestamps, priority.
removeWork
public java.lang.Object removeWork()
- Remove work from the wrapped collection.The collection itself will decide whether this is
FIFO, LIFO, and any other necessary ordering.
- Specified by:
removeWork
in interface WorkGroup
- Returns:
- work of type Object.
size
public int size()
- Check how many items in work collection.
- Specified by:
size
in interface WorkGroup
- Returns:
- size of work collection.
isEmpty
public boolean isEmpty()
- Check whether work has one or more work items in collection.
- Specified by:
isEmpty
in interface WorkGroup
- Returns:
- true or false.