return "ERROR: HTTP start is not enabled for this pipe";
}
//If pipesAndThreads already contains the pipe, get the PipeExecutionThread from it
pipesIt=pipesAndThreads.keySet().iterator();
PipeExecutionThread pet = null;
while(pipesIt.hasNext()){
PipeWrapper p = (PipeWrapper)pipesIt.next();
String db=((PipeExecutionThread)pipesAndThreads.get(p)).getDatabaseName();
if(p.getPipe().getName().equals(pipe.getPipe().getName()) && db.equals(pipe.getDatabase())){
pet = (PipeExecutionThread) pipesAndThreads.get(p);
}
}
Long pipeId=pipe.getPipe().getId();
if (pet == null || !pet.getDatabaseName().equals(database)) {
// Create new thread if no execution thread exists.
pet = new PipeExecutionThread(pipesAndThreads,pipeId,pers);
// Add the created thread to webapp context
pipesAndThreads.put(pipe, pet);
//Remember that new thread was created and this has to be started
newThread = true;
}
// Add the new request to the threads execution queue
pet.getPipeExecutionQueue().addToQueue(
new PipeExecutionRequest(pipe.getPipe(), new Date()));
if (newThread)
pet.start();
if (isSynced) {
// If synced mode was specified, wait for the thread to finish
pet.join();
} else
// Otherwise get the queue length to return in the response
queueLength = pet.getPipeExecutionQueue().getQueueLength();
} catch (Exception e) {
Environment en=Environment.getInstance();
en.log("Exception while processing requests in pipe execution queue for pipe: " + pipeName);
en.log(e.getMessage(),e);