On 16.03.2012, at 10:47, Reto Bachmann-Gmür wrote:

> Hello,
> 
> I'm having issues with jobs that bever result as finished and
> EventJobManagerImpl.enhanceContent thus never ends waiting.
> 
> I think it would be good to have a timeout in EventJobManagerImpl for it to
> stop waiting for jobs after a while (and kiling the job if possible).
> 
> I'm not yet sure about the reason for my Job never resulting as finished,
> but a potential cause I think is the exception handling in
> EnhancementJobHanlder: EnigneExceptions are caught and cause the job to be
> marked as failed, while other exceptions don't result in the job being
> marked as failed.
> 
> Any thoughts or experiences on failing jobs?
> 

While developing the EventJobManager this was indeed a problem.  My solution 
was than to add a try catch(Throwable t) covering the event processing in the 
EnhancementJobHandler#handleEvent(..) that sets the Job as failed within the 
catch clause.

This solved the problem with dealing of RuntimeException thrown by 
EnhancementEngines.

So I assume that the problem you encounter is 

(1) an engine that does not finish
(2) an deadlock
(3) an runtime exception within the EventJobManager implementation

Reto can you reproduce this? If yes a DEBUG level log would really help to 
trace this down

regarding

> I think it would be good to have a timeout in EventJobManagerImpl for it to
> stop waiting for jobs after a while (and kiling the job if possible).

That would need further investigation. 

The felix implementation of the EventAdmin [1] provides the possibility to 
configure a Timeout ("org.apache.felix.eventadmin.Timeout").
However if this happens the EventHandler is blacklisted. This would cause that 
all event handling done by the EventJobManager would be stopped as all Events 
are precessed by the same Handler. Because of that I was not able to use this 
and had to deactivate Timeouts for the used Topic.

If someone knows an other possibility to implement this I would be clearly 
interested

best
Rupert



[1] http://felix.apache.org/site/apache-felix-event-admin.html



best
Rupert

> Cheers,
> Reto

Reply via email to