0

I have problem with asynchronus execution of my code. Method startConversion() should be called asynchronusly. call goes trought AOP proxy.

Everything separated works fine. Problem occurs when I put together @Async and @MonitoredWithSpring annotations

javamelody is defined in webxml in first xml - OK

Spring async support is defiend in xml - OK

Code works well without @MonitoredWithSpring. But i need this bean to be monitored.

Sample code:

@MonitoredWithSpring //L1 - if this line removed @async will work
public interface IOfficeConversionService {
    void startConversion ();
}

Implementing class

@Service
public class COfficeConversionSevice implements IOfficeConversionService {
    @Override
    @Transactional
    @Async ("officeFileConversionExecutor")
    public void startConversion () {
         //ASYNC work
    }
}   
  • With L1 present, code will call method startConversion() synchronusly.
  • Without L1 everything works fine, and method startConversion() is called asynchronusly in new thread

In stacktrace don't even create async pointcut. @Async annotation is never processed by its postProcessor. @Transactional works, and transaction is created. No error in initialization

Spring configuration

<context:annotation-config />
<aop:aspectj-autoproxy />

<task:executor id="mailexecutor" pool-size="25-100" queue-capacity="1000" rejection-policy="ABORT"  />
<task:executor id="pnpexecutor" pool-size="5"  />
<task:executor id="officeFileConversionExecutor" pool-size="5"  />
<task:scheduler id="systemScheduler" pool-size="5" />
<task:annotation-driven executor="mailexecutor" scheduler="systemScheduler"/>

Can you help me? Some suggestion ?
I am out of ideas.

MarekM
  • 1,426
  • 17
  • 14

0 Answers0