public class SimpleDistributionQueue extends Object implements DistributionQueue
DistributionQueue
.
Note that, at the moment, this is a transient in memory queue not persisted on the repository and
therefore not usable for production.
Note: potentially the Queue could contain the ordered package ids, with a sidecar map id->item;
that way removal could be faster.Constructor and Description |
---|
SimpleDistributionQueue(String agentName,
String name) |
Modifier and Type | Method and Description |
---|---|
DistributionQueueEntry |
add(@NotNull DistributionQueueItem item)
add a distribution item to this queue
|
@Nullable DistributionQueueEntry |
getHead()
get the first item (in a FIFO strategy, the next to be processed) from the queue
|
@Nullable DistributionQueueEntry |
getItem(@NotNull String id)
gets an item from the queue by specifying its id
|
@NotNull Iterable<DistributionQueueEntry> |
getItems(int skip,
int limit)
get all the items in the queue
|
@NotNull String |
getName()
get this queue name
|
@NotNull DistributionQueueStatus |
getStatus()
get the status of the queue
|
DistributionQueueType |
getType()
get the type of this queue
|
@Nullable DistributionQueueEntry |
remove(@NotNull String id)
remove an item from the queue by specifying its id
|
String |
toString() |
@NotNull public @NotNull String getName()
DistributionQueue
getName
in interface DistributionQueue
public DistributionQueueEntry add(@NotNull @NotNull DistributionQueueItem item)
DistributionQueue
add
in interface DistributionQueue
item
- a distribution item, typically representing a DistributionPackage
to distributenoll
if none is created@Nullable public @Nullable DistributionQueueEntry getHead()
DistributionQueue
getHead
in interface DistributionQueue
null
if the queue is empty@NotNull public @NotNull DistributionQueueStatus getStatus()
DistributionQueue
getStatus
in interface DistributionQueue
public DistributionQueueType getType()
DistributionQueue
getType
in interface DistributionQueue
@NotNull public @NotNull Iterable<DistributionQueueEntry> getItems(int skip, int limit)
DistributionQueue
getItems
in interface DistributionQueue
skip
- the number of items to skiplimit
- the maximum number of items to return. use -1 to return all items.Iterable
of DistributionQueueItem
s@Nullable public @Nullable DistributionQueueEntry getItem(@NotNull @NotNull String id)
DistributionQueue
getItem
in interface DistributionQueue
id
- the id of the item as returned by DistributionQueueItem.getPackageId()
null
if the item with the given id
doesn't exist@Nullable public @Nullable DistributionQueueEntry remove(@NotNull @NotNull String id)
DistributionQueue
remove
in interface DistributionQueue
id
- the id the item as returned by DistributionQueueItem.getPackageId()
null
if the item with the given id
doesn't existCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.