withNewSession vs. persistenceInterceptor.init()

82 views
Skip to first unread message

Aaron

unread,
Aug 24, 2015, 10:41:34 AM8/24/15
to Grails Dev Discuss
We've been using the Executor plugin for awhile, but it seems somewhat out of date. I notice in the GormAsyncStaticApi that the decorator for the promise API simply does a withNewSession() instead of anything more elaborate. Following the implementation, it seems like withNewSession() vs. the persistenceInterceptor.init() -> flush() -> destroy() are fairly different in implementation.

Would there be any expected behavior differences between using one vs. the other? We continue to see some unexplainable session behavior in a few places and want to make sure we aren't doing anything weird with our threading model.

If withNewSession() is all that's needed, seems like maybe an update to the executor plugin to just wrap or use the Promise API might be in order.

-Aaron


Graeme Rocher

unread,
Aug 26, 2015, 11:13:25 AM8/26/15
to grails-de...@googlegroups.com
Is the executor plugin still necessary given the async support?

Cheers

Graeme Rocher
Grails Project lead


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/bf4f5eb0-01d8-47b6-96bf-347e85f42063%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron

unread,
Aug 26, 2015, 11:22:43 AM8/26/15
to Grails Dev Discuss
It's really needed more for integration with existing libraries and API's.

For example, when defining service-activators in spring, you can give an executorService bean reference that needs to conform to that API. It's useful to have that automatically wrapped in persistence context.

For simple backgrounding, the Promise API is much better.

Shouldn't the executor service be using the same wrapping mechanism as the Promise API decorators?

-Aaron

On Wednesday, August 26, 2015 at 11:13:25 AM UTC-4, Graeme Rocher wrote:
Is the executor plugin still necessary given the async support?

Cheers

Graeme Rocher
Grails Project lead


On Mon, Aug 24, 2015 at 4:41 PM, Aaron <lon...@gmail.com> wrote:

We've been using the Executor plugin for awhile, but it seems somewhat out of date. I notice in the GormAsyncStaticApi that the decorator for the promise API simply does a withNewSession() instead of anything more elaborate. Following the implementation, it seems like withNewSession() vs. the persistenceInterceptor.init() -> flush() -> destroy() are fairly different in implementation.

Would there be any expected behavior differences between using one vs. the other? We continue to see some unexplainable session behavior in a few places and want to make sure we aren't doing anything weird with our threading model.

If withNewSession() is all that's needed, seems like maybe an update to the executor plugin to just wrap or use the Promise API might be in order.

-Aaron


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages