You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Thiago Veronezi <th...@veronezi.org> on 2010/08/06 03:10:07 UTC
Wrapped Exception - Container behavior question.
Guys, I've uploaded some changes related to the "AccessTimeout" and
"ConcurrentAccessTimeoutException"...
(Stateful) https://issues.apache.org/jira/browse/OPENEJB-1144
(Singleton) https://issues.apache.org/jira/browse/OPENEJB-1151
... But I still have a questionabout the exception thrown by the server.
Check the test code below...
*************************************************
[StatefulConcurrencyTest]
public void testConcurrentMethodCall() throws Exception {
InitialContext ctx = new InitialContext();
MyLocalBean bean = (MyLocalBean) ctx.lookup("MyLocalBeanImplLocal");
MyLocalBean bean2 = (MyLocalBean)
ctx.lookup("MyLocalBeanImplLocal");
Thread runThread = new Thread(new CallRentrantThread(bean, 3000));
runThread.start();
try {
bean2.callRentrant(bean, 0);
assertTrue(false);
} catch (Exception e) {
assertTrue(e.getCause() instanceof ConcurrentAccessTimeoutException);
}
}
*************************************************
[SingletonConcurrencyTest]
public void testConcurrentMethodCall() throws Exception {
InitialContext ctx = new InitialContext();
final MyLocalBean bean = (MyLocalBean)
ctx.lookup("MyLocalBeanImplLocal");
bean.callRentrantRead(ctx, 1000);
bean.callRentrantWrite(ctx, 1000);
Thread startRun = new Thread(new CallRentrantWriteThread(ctx,
5000));
startRun.start();
try {
bean.doNothingRead(0);
assertTrue(false);
} catch (ConcurrentAccessTimeoutException e) {
assertTrue(true);
}
}
*************************************************
The ConcurrentAccessTimeoutException thrown by the StatefulContainer is
wrapped by another Exception, while the
same ConcurrentAccessTimeoutException is thrown directly by the
SingletonContainer.
Question: Which one is thrown correctly?
[]s,
Thiago.