• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Interceptors and Multithreading

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am a new bee to EJB and wanted some suggestions on Multithreading with Interceptors.
My project requirement is, we need to log some message before an call to merge or persistEntity is called. So I decided to use interceptor and got it working, but I want to further do some business logic in the interceptor and do not want the actual ejb call to wait till the business logic is completed. So in short, I want to fork a new thread for my business logic and do a context.proceed() so that the actual call goes thru.
Please share your thoughts......

Thanks
Sridhar
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sridhar nagarhalli wrote:
but I want to further do some business logic in the interceptor and do not want the actual ejb call to wait till the business logic is completed. So in short, I want to fork a new thread for my business logic and do a context.proceed() so that the actual call goes thru.


Interceptors aren't meant for spawning threads within a Java EE environment. What exactly is the use case?
 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should not create threads within EJBs. Instead you can inject EJB in your interceptor and invoke a method from injected EJB that is annotated with @Asynchronous.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic