Handing exceptions in Quartz thread in Seam

365 views Asked by At

I've got a pool of 10 threads and a few Cron jobs. These cron jobs check several different FTP/SFTP or POP connections at different intervals for incoming messages, add them to a processing queue or process the actual messages from the queue.

That all works fine until I get an exception in one of the threads e.g. DefaultQuartzScheduler_Worker-1 (in this case it was a ValidationException). After that, the thread is broken and no transaction is active when it tries to access the database:

15:30:06,231 WARN  [][][org.hibernate.engine.jdbc.spi.SqlExceptionHelper][SqlExceptionHelper] (DefaultQuartzScheduler_Worker-1) SQLSQL Error: 0, SQLState: null
15:30:06,231 ERROR [][][org.hibernate.engine.jdbc.spi.SqlExceptionHelper][SqlExceptionHelper] (DefaultQuartzScheduler_Worker-1) javax.resource.ResourceException: IJ000460: Error checking for a transaction

The cron jobs continue to work fine on the Threads DefaultQuartzScheduler_Worker-2 to DefaultQuartzScheduler_Worker-10 but whenever DefaultQuartzScheduler_Worker-1 is used it fails to do anything involving the database.

How can I recover from that? I basically either want to remove that thread from the pool or 'repair' it.

I've seen the chapter on Handling Async Exceptions in the Seam documentation using the org.jboss.seam.async.asynchronousExceptionHandler: Chapter 22. Asynchronicity and messaging: http://docs.jboss.org/seam/snapshot/en-US/html/jms.html

That is probably the right place to start but what do I do there? How can I access the thread pool and remove one thread from it or repair it?

I don't want to cancel the cron jobs.

Environment: Seam 2.3 with Quartz on JBoss EAP 6.1

0

There are 0 answers