/** * Mark the workpackage as ready for processing and wait until the workpackage gets processed * * @param workpackageQueue * @param workpackage * @throws TimeoutException * @throws ExecutionException * @throws InterruptedException */ public void markReadyForProcessingAndWait( final IWorkPackageQueue workpackageQueue, final I_C_Queue_WorkPackage workpackage) throws InterruptedException, ExecutionException, TimeoutException { Future<IWorkpackageProcessorExecutionResult> futureResult = workpackageQueue.markReadyForProcessingAndReturn(workpackage); futureResult.get(1, TimeUnit.MINUTES); }
public List<I_C_Queue_WorkPackage> createAndEnqueueWorkpackages( final IWorkPackageQueue workpackageQueue, final int count, final boolean markReadyForProcessing) { final I_C_Queue_Block block = workpackageQueue.enqueueBlock(ctx); final List<I_C_Queue_WorkPackage> workpackages = new ArrayList<I_C_Queue_WorkPackage>(count); for (int i = 1; i <= count; i++) { final I_C_Queue_WorkPackage wp = workpackageQueue.enqueueWorkPackage(block, IWorkPackageQueue.PRIORITY_AUTO); POJOWrapper.setInstanceName(wp, "workpackage-" + i); if (markReadyForProcessing) { workpackageQueue.markReadyForProcessing(wp); } workpackages.add(wp); } return workpackages; }