Package com.wavefront.agent.queueing
Interface TaskQueue<T extends DataSubmissionTask<T>>
-
- Type Parameters:
T- type of objects stored.
- All Known Implementing Classes:
DataSubmissionQueue,TaskQueueStub
public interface TaskQueue<T extends DataSubmissionTask<T>>Proxy-specific queue interface, which is basically a wrapper for a Tape queue. This allows us to potentially support more than one backing storage in the future.- Author:
- [email protected].
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadd(T t)Add a task to the end of the queuevoidclear()Empty and re-initialize the queue.voidclose()Close the queue.LonggetAvailableBytes()Returns the total number of pre-allocated but unused bytes in the backing file.Tpeek()Retrieve a task that is currently at the head of the queue.voidremove()Remove a task from the head of the queue.intsize()Returns a number of tasks currently in the queue.Longweight()Returns the total weight of the queue (sum of weights of all tasks).
-
-
-
Method Detail
-
peek
T peek()
Retrieve a task that is currently at the head of the queue.- Returns:
- task object
-
add
void add(@Nonnull T t) throws IOException
Add a task to the end of the queue- Parameters:
t- task- Throws:
IOException- IO exceptions caught by the storage engine
-
remove
void remove() throws IOExceptionRemove a task from the head of the queue. Requires peek() to be called first, otherwise anIllegalStateExceptionis thrown.- Throws:
IOException- IO exceptions caught by the storage engine
-
clear
void clear()
Empty and re-initialize the queue.
-
size
int size()
Returns a number of tasks currently in the queue.- Returns:
- number of tasks
-
close
void close()
Close the queue. Should be invoked before a graceful shutdown.
-
weight
@Nullable Long weight()
Returns the total weight of the queue (sum of weights of all tasks).- Returns:
- weight of the queue (null if unknown)
-
-