Results 1 to 2 of 2

Thread: Intercepting async calls

  1. #1
    Join Date
    Sep 2007
    Posts
    9

    Default Intercepting async calls

    Hi everyone !

    Simple question : I'm using the @Async annotation and I'm wondering if there is an existing interceptor allowing to execute some in-house code :
    - (1) just before the async thread is started (we're on the caller thread)
    - (2) just after the async thread is started (we're on the called thread)

    In (1) I'd like to be able to transmit caller stacktrace to called thread, via a special method parameter
    In (2) I'd like to populate current thread local with latter special method parameter values

    WDYT ?

  2. #2
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    710

    Default

    From what I've read, AspectJ pointcuts can target specific annotations. I don't think there's any particular reason why you couldn't target @Async; if I were you I would give it a try. Of course with @Before and @AfterReturning you could pass all the parameters you need...for that, just take a look at the specific section in the Spring reference guide.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •