X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-node%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fnode%2FDeliveryQueue.java;h=d447bcc1d3438767a43e33d346f46dda00b1d781;hb=adb2ad2d16e851fbf8dcc71af68949a74463204d;hp=0b9ea494c5926df01f6a9e9977d3d978c1b5c1f6;hpb=0645ccf674f388cc989ef43d2ce24f359915e453;p=dmaap%2Fdatarouter.git diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java index 0b9ea494..d447bcc1 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java @@ -53,7 +53,6 @@ import org.jetbrains.annotations.Nullable; * delivery fails while the delay was active, it will not change the delay * or change the duration of any subsequent delay. * If, however, it succeeds, it will cancel the delay. - * * The queue maintains 3 collections of files to deliver: A todoList of * files that will be attempted, a working set of files that are being * attempted, and a retry set of files that were attempted and failed. @@ -83,6 +82,16 @@ public class DeliveryQueue implements Runnable, DeliveryTaskHelper { private File dir; private List todoList = new ArrayList<>(); + /** + * Create a delivery queue for a given destination info. + */ + DeliveryQueue(DeliveryQueueHelper deliveryQueueHelper, DestInfo destinationInfo) { + this.deliveryQueueHelper = deliveryQueueHelper; + this.destinationInfo = destinationInfo; + dir = new File(destinationInfo.getSpool()); + dir.mkdirs(); + } + /** * Try to cancel a delivery task. * @@ -215,29 +224,16 @@ public class DeliveryQueue implements Runnable, DeliveryTaskHelper { todoindex = 0; todoList = new ArrayList<>(); String[] files = dir.list(); - Arrays.sort(files); - scanForNextTask(files); + if (files != null) { + Arrays.sort(files); + scanForNextTask(files); + } retry = new HashMap<>(); } - DeliveryTask dt = getDeliveryTask(mindate); - if (dt != null) { - return dt; - } - return null; - + return getDeliveryTask(mindate); } } - /** - * Create a delivery queue for a given destination info. - */ - DeliveryQueue(DeliveryQueueHelper deliveryQueueHelper, DestInfo destinationInfo) { - this.deliveryQueueHelper = deliveryQueueHelper; - this.destinationInfo = destinationInfo; - dir = new File(destinationInfo.getSpool()); - dir.mkdirs(); - } - /** * Update the destination info for this delivery queue. */ @@ -450,4 +446,4 @@ public class DeliveryQueue implements Runnable, DeliveryTaskHelper { } return fname2; } -} +} \ No newline at end of file