Package com.wavefront.agent.queueing
Interface TaskQueue<T extends DataSubmissionTask<T>>
-
- Type Parameters:
T
- type of objects stored.
- All Superinterfaces:
Iterable<T>
- All Known Implementing Classes:
FileBasedTaskQueue
,InMemorySubmissionQueue
,InstrumentedTaskQueueDelegate
,SQSSubmissionQueue
,TaskQueueStub
public interface TaskQueue<T extends DataSubmissionTask<T>> extends Iterable<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 void
add(T entry)
Add a task to the end of the queuevoid
clear()
Empty and re-initialize the queue.void
close()
Close the queue.Long
getAvailableBytes()
Returns the total number of pre-allocated but unused bytes in the backing file.T
peek()
Retrieve a task that is currently at the head of the queue.void
remove()
Remove a task from the head of the queue.int
size()
Returns a number of tasks currently in the queue.Long
weight()
Returns the total weight of the queue (sum of weights of all tasks).-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
peek
@Nullable T peek()
Retrieve a task that is currently at the head of the queue.- Returns:
- task object
-
add
void add(@Nonnull T entry) throws IOException
Add a task to the end of the queue- Parameters:
entry
- task- Throws:
IOException
- IO exceptions caught by the storage engine
-
remove
void remove() throws IOException
Remove a task from the head of the queue. Requires peek() to be called first, otherwise anIllegalStateException
is thrown.- Throws:
IOException
- IO exceptions caught by the storage engine
-
clear
void clear() throws IOException
Empty and re-initialize the queue.- Throws:
IOException
-
size
int size()
Returns a number of tasks currently in the queue.- Returns:
- number of tasks
-
close
void close() throws IOException
Close the queue. Should be invoked before a graceful shutdown.- Throws:
IOException
-
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)
-
-