use of org.apache.sling.distribution.queue.DistributionQueueItemState in project sling by apache.
the class SimpleDistributionQueue method add.
public DistributionQueueEntry add(@Nonnull DistributionQueueItem item) {
DistributionQueueItemState itemState = DistributionQueueItemState.ERROR;
boolean result = false;
try {
result = queue.offer(item);
itemState = DistributionQueueItemState.QUEUED;
} catch (Exception e) {
log.error("cannot add an item to the queue", e);
} finally {
statusMap.put(item, new DistributionQueueItemStatus(Calendar.getInstance(), itemState, 0, name));
}
if (result) {
return new DistributionQueueEntry(item.getPackageId(), item, statusMap.get(item));
}
return null;
}
Aggregations