Package com.wavefront.agent.queueing
Class DataSubmissionQueue<T extends DataSubmissionTask<T>>
- java.lang.Object
-
- com.squareup.tape2.ObjectQueue<T>
-
- com.wavefront.agent.queueing.DataSubmissionQueue<T>
-
- Type Parameters:
T- type of objects stored.
- All Implemented Interfaces:
TaskQueue<T>,Closeable,AutoCloseable,Iterable<T>
public class DataSubmissionQueue<T extends DataSubmissionTask<T>> extends com.squareup.tape2.ObjectQueue<T> implements TaskQueue<T>
Implements proxy-specific queue interface as a wrapper over tapeObjectQueue- Author:
- [email protected]
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.squareup.tape2.ObjectQueue
com.squareup.tape2.ObjectQueue.Converter<T extends Object>
-
-
Constructor Summary
Constructors Constructor Description DataSubmissionQueue(com.squareup.tape2.ObjectQueue<T> delegate, String handle, com.wavefront.data.ReportableEntityType entityType)
-
Method Summary
All Methods Instance Methods Concrete 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.com.squareup.tape2.QueueFilefile()LonggetAvailableBytes()Returns the total number of pre-allocated but unused bytes in the backing file.Iterator<T>iterator()Tpeek()Retrieve a task that is currently at the head of the queue.List<T>peek(int max)voidremove(int tasksToRemove)intsize()Returns a number of tasks currently in the queue.Longweight()Returns the total weight of the queue (sum of weights of all tasks).-
Methods inherited from class com.squareup.tape2.ObjectQueue
asList, create, createInMemory, isEmpty, remove
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
file
public com.squareup.tape2.QueueFile file()
- Specified by:
filein classcom.squareup.tape2.ObjectQueue<T extends DataSubmissionTask<T>>
-
peek
public List<T> peek(int max)
- Overrides:
peekin classcom.squareup.tape2.ObjectQueue<T extends DataSubmissionTask<T>>
-
peek
public T peek()
Description copied from interface:TaskQueueRetrieve a task that is currently at the head of the queue.- Specified by:
peekin interfaceTaskQueue<T extends DataSubmissionTask<T>>- Specified by:
peekin classcom.squareup.tape2.ObjectQueue<T extends DataSubmissionTask<T>>- Returns:
- task object
-
add
public void add(@Nonnull T t) throws IOException
Description copied from interface:TaskQueueAdd a task to the end of the queue- Specified by:
addin interfaceTaskQueue<T extends DataSubmissionTask<T>>- Specified by:
addin classcom.squareup.tape2.ObjectQueue<T extends DataSubmissionTask<T>>- Parameters:
t- task- Throws:
IOException- IO exceptions caught by the storage engine
-
clear
public void clear()
Description copied from interface:TaskQueueEmpty and re-initialize the queue.- Specified by:
clearin interfaceTaskQueue<T extends DataSubmissionTask<T>>- Overrides:
clearin classcom.squareup.tape2.ObjectQueue<T extends DataSubmissionTask<T>>
-
remove
public void remove(int tasksToRemove)
- Specified by:
removein classcom.squareup.tape2.ObjectQueue<T extends DataSubmissionTask<T>>
-
size
public int size()
Description copied from interface:TaskQueueReturns a number of tasks currently in the queue.- Specified by:
sizein interfaceTaskQueue<T extends DataSubmissionTask<T>>- Specified by:
sizein classcom.squareup.tape2.ObjectQueue<T extends DataSubmissionTask<T>>- Returns:
- number of tasks
-
close
public void close()
Description copied from interface:TaskQueueClose the queue. Should be invoked before a graceful shutdown.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTaskQueue<T extends DataSubmissionTask<T>>
-
iterator
@Nonnull public Iterator<T> iterator()
- Specified by:
iteratorin interfaceIterable<T extends DataSubmissionTask<T>>
-
weight
@Nullable public Long weight()
Description copied from interface:TaskQueueReturns the total weight of the queue (sum of weights of all tasks).- Specified by:
weightin interfaceTaskQueue<T extends DataSubmissionTask<T>>- Returns:
- weight of the queue (null if unknown)
-
getAvailableBytes
@Nullable public Long getAvailableBytes()
Description copied from interface:TaskQueueReturns the total number of pre-allocated but unused bytes in the backing file. May return null if not applicable.- Specified by:
getAvailableBytesin interfaceTaskQueue<T extends DataSubmissionTask<T>>- Returns:
- total number of available bytes in the file or null
-
-