private void pulseDownload() { if(processingState.canContinue()) { if (!processingState.isProcessedToConsensus()) { if(!processingState.isProcessedToConsensus()) { processingState = ItemProcessingState.DOWNLOADING; } synchronized (mutex) { if (item == null && (downloader == null || downloader.isDone())) { downloader = (ScheduledFuture<?>) executorService.submit(() -> download(), Node.this.toString() + toString() + " :: item pulseDownload -> download"); } } } } }
Node.this.toString() + toString() + " :: ItemProcessor -> itemDownloaded");
private final void approveAndCommit() { report(getLabel(), () -> concatReportMessage("item processor for item: ", itemId, " from parcel: ", parcelId, " :: approveAndCommit, state ", processingState, " itemState: ", getState()), DatagramAdapter.VerboseLevel.BASE); if(processingState.canContinue()) { // todo: fix logic to surely copy approving item dependency. e.g. download original or at least dependencies // first we need to flag our state as approved setState(ItemState.APPROVED); executorService.submit(() -> downloadAndCommit(), Node.this.toString() + toString() + " :: approveAndCommit -> downloadAndCommit"); } }
/** * Start checking if item was downloaded and wait for isCheckingForce flag. * If item hasn't downloaded just set isCheckingForce for true. * @param isCheckingForce */ private void forceChecking(boolean isCheckingForce) { report(getLabel(), () -> concatReportMessage("item processor for item: ", itemId, " from parcel: ", parcelId, " :: forceChecking, state ", processingState, " itemState: ", getState()), DatagramAdapter.VerboseLevel.BASE); this.isCheckingForce = isCheckingForce; if(processingState.canContinue()) { if (processingState == ItemProcessingState.DOWNLOADED) { executorService.submit(() -> { checkItem(); }, Node.this.toString() + toString() + " :: forceChecking -> checkItem"); } } }