发帖    主题    评论    推荐    标签    作者    订阅    查搜    注册   登陆   关注
 
面向对象 设计模式 领域驱动设计 企业架构 框架 开发教程 微服务 CQRS 扩展性 并发编程 事件溯源 分布式 SOA
1 2 3 4 ... 6 下一页 Go 6

invoke ejb ,JTA in tomcat server will get the error.

         
2004-04-19 15:26
赞助商链接

i use the tomcat server and a ejb server envirmoment.
some logic code is like these:

class ship
{
UserTransaction ut=null;
public void begin()
{
ut=new UserTransaction
ut.begin();
}

public void add(String nn) throws Exception
{
invoke some ejb
save some data into database
}
public void commit()
{
ut.commit();
}
public void rollback()
{
ut.rollback();
}
}


and this class will be save and invoke in tomcat jsp file.


a complete transaction is like these
step 1 )file1.jsp to start the transaction
2 )file2.jsp to add the data or detail ,like buy
information, product ....
3)file3.jsp to commit transaction or rollback transaction

eg)
tomcat ship in session
client1 --- connect-- Thread1 --- ship.begin() file1.jsp
cleint2---------------- Thread2 --- ship.begin() file1.jsp
client1 ---------------Thread3 ----- ship.add("aa") file2.jsp
client2--------------- thread2------ship.add("aa") file2.jsp
client2-----------------Thread2-----ship.commit() file3.jsp

i had did the test ,and confirm the client cant confirm get the some thread in tomcat server.


if like the client2 will not get any error and can execute sucessful.
but the tomcat Thread pool cant control by jboss .
so how does it solve this problem??
thanks you very much.
because i try to implement a software like ejb server ,and self yo provider the distrubtion transaction function. and i got this problem, hope you can help me to solve it.thank you

2004-04-19 21:29

The crux of your problem is to provide a transaction control which span several threads.(each invocation of *.jsp means a new thread.) Although such transaction is allowed by means of stateful-session-bean, the usage is strongly discouraged for the reason of its error-prone. U'd better refactor your code and finish the transaction in single thread.

2004-04-19 21:38

by the way, could u tell the problem in chinese? it's quite tough to dig out your problem! :)

2004-04-20 09:25

Sorry,cos in my company not the chinese system can type the chinese.

so that mean we cant use the transaction in many threads ,or can invoke it in single thread? is it like that?

and how the stateful-session bean working in the JTA.
can give some code or examples.
thanks you very much.

2004-04-20 12:21

My Advice: NEVER make the transaction span several threads!

6Go 1 2 3 4 ... 6 下一页

赞助商链接

赞助商链接

返回顶部

移动版 关于本站 使用帮助 联系管理员 最佳分辨率1366x768
OpenSource JIVEJDON Powered by JdonFramework Code © 2002-20 jdon.com