i built a pipeline within my seam application. that is, a user can upload a file to the
server and as soon as the file is uploaded, the pipeline starts. even when the user logs
out, the pipeline still runs until every task is comleted. the several tasks read file
contents and save it into a database. my problem now is that i can't Inject my
EntityManager or the Seam Logger into my Pipeline classes. EntityManager and Logger are
always null. This Pipeline classes are ThreadPoolExecutors with @Name Annotation. In all
other classes (e.g.my UploadBean which is sateless) i can inject the EntityManager and the
em.persist(obj) works fine.I remember that i got an no application context active
exception, has that anything to do with it? I now try to solve this problem by using jBPM,
but is this the only way to implement async workflow?
the following is one of my PipeLine classes which will thorow a null pointer exception
while trying to persist a task due EntityManager is null because its not injected
@Name("convertexecutor")
public class ConvertExecutor extends PipelineExecutor implements IPipelineExecutor {
@In
private EntityManager entityManager;
public ConvertExecutor(int corePoolSize, int maximumPoolSize,
long keepAliveTime, TimeUnit unit, BlockingQueue workQueue) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
protected void beforeExecute(Thread t, Runnable r) {
super.beforeExecute(t, r);
}
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
SplitTask task = new SplitTask(((PipelineTask) r).getUserUpload(),
((PipelineTask) r).getPriority());
ExecutorManager.getSplitExecutor().execute(task);
entityManager.persist(task);
}
}
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022035#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...