Quartz 2 Plugin - Exception in service always bubbling up to job

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Quartz 2 Plugin - Exception in service always bubbling up to job

eisnerj
Using Grails 2.0.1 and Quartz 2 plugin.

Here is a cut of my job/service architecture.  What I am seeing is that the exception is never being caught in ContentService.processContents().  It is always bubbling up to ContentProcessorJob and being caught there.  I need the exception to be caught in the ContentService so that it can be handled correctly. I only want unhandled exceptions to bubble back up to the ContentProcessorJob.  How do I fix this issue?  Any help is greatly appreciated.

=====
class ContentProcessorJob {
        public static int currentThreadCount = 0
       
        def contentService

        static triggers = {
                simple (name: "contentProcessorJob", startDelay: 10*DateUtils.MILLIS_IN_SECOND, repeatInterval: 30*DateUtils.MILLIS_IN_SECOND)
        }
       
        def execute() {
                try {
                        currentThreadCount++
                       
                        contentService.processContents()
                }
                catch(Throwable ex) {
                        log.error "Caught exception in ContentProcessorJob:\n", ex
                }
                finally {
                        currentThreadCount--
                }
        }
}

=======

class ContentService {
        public void processContents() {
                try {
                        new File ('test.txt) .createNewFile()
                }
                catch (Exception e) {
                        log.error "Exception creating file:\n", e
                }
        }
}
Reply | Threaded
Open this post in threaded view
|

Re: Quartz 2 Plugin - Exception in service always bubbling up to job

basejump (Josh)
The easiest way for me to help you is for you to fork the github project and make it happen in the sample/test qkiss project
https://github.com/9ci/grails-quartz2/tree/master/test/projects/qkiss

you can either send me the project zip but better yet point me to your forked github project so I can clone it and take a look

On Apr 17, 2012, at 3:06 PM, eisnerj wrote:

> Using Grails 2.0.1 and Quartz 2 plugin.
>
> Here is a cut of my job/service architecture.  What I am seeing is that the
> exception is never being caught in ContentService.processContents().  It is
> always bubbling up to ContentProcessorJob and being caught there.  I need
> the exception to be caught in the ContentService so that it can be handled
> correctly. I only want unhandled exceptions to bubble back up to the
> ContentProcessorJob.  How do I fix this issue?  Any help is greatly
> appreciated.
>
> =====
> class ContentProcessorJob {
> public static int currentThreadCount = 0
>
> def contentService
>
> static triggers = {
> simple (name: "contentProcessorJob", startDelay:
> 10*DateUtils.MILLIS_IN_SECOND, repeatInterval:
> 30*DateUtils.MILLIS_IN_SECOND)
> }
>
> def execute() {
> try {
> currentThreadCount++
>
> contentService.processContents()
> }
> catch(Throwable ex) {
> log.error "Caught exception in ContentProcessorJob:\n", ex
> }
> finally {
> currentThreadCount--
> }
> }
> }
>
> =======
>
> class ContentService {
> public void processContents() {
> try {
> new File ('test.txt) .createNewFile()
> }
> catch (Exception e) {
> log.error "Exception creating file:\n", e
> }
> }
> }
>
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Quartz-2-Plugin-Exception-in-service-always-bubbling-up-to-job-tp4565872p4565872.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Quartz 2 Plugin - Exception in service always bubbling up to job

eisnerj
I don't have access to forking your project.  This worked correctly in old quartz plugin.  It's a very simple test to figure out if it's working.  Are you able to catch exceptions in services called from your jobs?  Or are they bubbling up to the job's try/catch?

Anyone else have any ideas on how to fix this?
Reply | Threaded
Open this post in threaded view
|

Re: Quartz 2 Plugin - Exception in service always bubbling up to job

basejump (Josh)
When you say you don't have access what do you mean? github won't let you fork?

you can log an issue here too https://github.com/9ci/grails-quartz2/issues


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email