@Stateless
public class MyStatelessBeanA {
@Resource
private SessionContext sessionCtx;
public byte[] methodA(){
MyStatelessBeanA myStatelessProxy1 = this.sessionCtx.getBusinessObject(MyStatelessBeanA.class);
MyStatelessBeanA myStatelessProxy2 = this.sessionCtx.getBusinessObject(MyStatelessBeanA.class);
Future<byte[]> proxy1Future = myStatelessProxy1.asynchMethod();
Future<byte[]> proxy2Future = myStatelessProxy2.asynchMethod();
byte[] firstArray = proxy1Future.get();
byte[] secondArray = proxy2Future.get();
return ...
}
@Asynchronous
public Future<byte[]> asynchMethod(){
byte[] byteArray = ...
...do something including select from various table...
return new AsynchResult<byte[]>(byteArray);
}
Run Code Online (Sandbox Code Playgroud)
基本上我想做的是asynchMethod()从两个代理对象并行调用两次。
问题?
2019-11-05 17:20:23,354 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 3) SQL Error: 0, SQLState: null
2019-11-05 17:20:23,354 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB …Run Code Online (Sandbox Code Playgroud)