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
|
@NotNull Iterable<DistributionQueueEntry> |
clear(int limit)
Clear a range of entries from the queue.
|
@NotNull Iterable<DistributionQueueEntry> |
getEntries(int skip,
int limit)
get all the entries in the queue
|
@Nullable DistributionQueueEntry |
getEntry(@NotNull String id)
gets an entry from the queue by specifying its id
|
@Nullable DistributionQueueEntry |
getHead()
get the first entry (in a FIFO strategy, the next to be processed) from the queue
|
@NotNull String |
getName()
get this queue name
|
@NotNull DistributionQueueStatus |
getStatus()
get the status of the queue
|
@NotNull DistributionQueueType |
getType()
get the type of this queue
|
boolean |
hasCapability(@NotNull String capability) |
void |
recordProcessingAttempt(@NotNull DistributionQueueEntry entry) |
@NotNull Iterable<DistributionQueueEntry> |
remove(@NotNull Set<String> entryIds)
Remove a set entries from the queue by specifying their identifiers.
|
@Nullable DistributionQueueEntry |
remove(@NotNull String id)
remove an entry 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
@NotNull public @NotNull DistributionQueueType getType()
DistributionQueue
getType
in interface DistributionQueue
public boolean hasCapability(@NotNull @NotNull String capability)
hasCapability
in interface DistributionQueue
true
if the queue supports the capability ;
false
otherwise@NotNull public @NotNull Iterable<DistributionQueueEntry> getEntries(int skip, int limit)
DistributionQueue
getEntries
in interface DistributionQueue
skip
- the number of entries to skiplimit
- the maximum number of entries to return. use -1 to return all entries.Iterable
of DistributionQueueEntry
entries@Nullable public @Nullable DistributionQueueEntry getEntry(@NotNull @NotNull String id)
DistributionQueue
getEntry
in interface DistributionQueue
id
- the entry identifiernull
if the entry with the given id
doesn't exist@NotNull public @NotNull Iterable<DistributionQueueEntry> remove(@NotNull @NotNull Set<String> entryIds)
DistributionQueue
remove
in interface DistributionQueue
entryIds
- The identifiers of the entries to be removed@Nullable public @Nullable DistributionQueueEntry remove(@NotNull @NotNull String id)
DistributionQueue
remove
in interface DistributionQueue
id
- the entry identifiernull
if the entry with the given id
doesn't exist@NotNull public @NotNull Iterable<DistributionQueueEntry> clear(int limit)
DistributionQueue
clear
in interface DistributionQueue
limit
- The maximum number of entries to remove. All entries
are removed when the limit is -1
.public void recordProcessingAttempt(@NotNull @NotNull DistributionQueueEntry entry)
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.