Skip to content

Commit

Permalink
Fix incorrect process status code and add more logging for failures i…
Browse files Browse the repository at this point in the history
…n async tasks.
  • Loading branch information
Carlos A. Munoz committed Aug 28, 2013
1 parent e875eea commit 2051da3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.RunAsOperation;

import lombok.extern.slf4j.Slf4j;

/**
* This class executes a Runnable Process asynchronously. Do not use this class directly.
* Use {@link org.zanata.async.TaskExecutor} instead as this is just a wrapper to make sure
Expand All @@ -43,6 +45,7 @@
@Name("asynchronousTaskExecutor")
@Scope(ScopeType.STATELESS)
@AutoCreate
@Slf4j
public class AsynchronousTaskExecutor
{
@Asynchronous
Expand All @@ -63,6 +66,7 @@ public void execute()
catch (Exception t)
{
task.getHandle().setException(t);
AsynchronousTaskExecutor.log.error("Exception when executing an asynchronous task.", t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,13 @@ public ProcessStatus getProcessStatus(@PathParam("processId") String processId)
catch (InterruptedException e)
{
// The process was forcefully cancelled
status.setStatusCode(ProcessStatusCode.Failed);
status.setMessages(Lists.newArrayList(e.getMessage()));
}
catch (ExecutionException e)
{
// Exception thrown while running the task
status.setStatusCode(ProcessStatusCode.Failed);
status.setMessages(Lists.newArrayList(e.getCause().getMessage()));
}

Expand Down

0 comments on commit 2051da3

Please sign in to comment.