private void addProcessing(Processing processing) { if ( ! isAcceptingNewProcessings()) throw new IllegalStateException("Docproc service " + getName() + " is not accepting new incoming processings. Cannot add " + processing + " "); if ( ! queue.offer(processing)) throw new RejectedExecutionException("Docproc service " + getName() + " is busy, please try later"); }
/** * Asynchronously process the given document operations as one unit * using the processing chain of this service, * and call the specified ProcessingEndpoint when done. * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void processDocumentOperations(List<DocumentOperation> documentOperations, ProcessingEndpoint endp) { addProcessing(Processing.createProcessingFromDocumentOperations(getName(), documentOperations, new CallStack(getCallStack()), endp)); }
/** * Sets a new processing stack for this service. This will be the Prototype * for the call stacks of individual processings in this service */ public void setCallStack(CallStack stack) { DocprocExecutor ex = ((getExecutor() == null) ? new DocprocExecutor(getName(), stack) : new DocprocExecutor(getExecutor(), stack)); setExecutor(ex); }
/** * Asynchronously process the given document put or document update using the processing * chain of this service, and call the specified ProcessingEndpoint when done. * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void process(DocumentOperation documentOperation, ProcessingEndpoint endp) { addProcessing(new Processing(getName(), documentOperation, new CallStack(getCallStack()), endp)); }
/** * Asynchronously process the given Processing using the processing * chain of this service, and call the specified ProcessingEndpoint when done. * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void process(Processing processing, ProcessingEndpoint endp) { processing.setServiceName(getName()); processing.setCallStack(new CallStack(getCallStack())); processing.setEndpoint(endp); addProcessing(processing); }