是否覆盖WebSphere设置的事务超时? [英] Overwriting Transaction Timeout set by WebSphere?

查看:837
本文介绍了是否覆盖WebSphere设置的事务超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在一个项目中,我们有一个方法被调用来生成报告,然后将其返回给客户端.整个过程如下所示:

I am currently in a project where we have a method that is called to generate a report and then return it to the client side. The whole process works something like this:

[[应用程序]]-> [[JMS]]-> [[数据库服务器]]

[[Application]] --> [[JMS]] --> [[DB Server]]

但是,我们的WebSphere具有全局设置,其中事务超时"设置为2分钟,最大事务超时"设置为5分钟.

However, our WebSphere has a global setting where Transaction Timeout is set to 2 minutes, and Maximum Transaction Timeout is set to 5 minutes.

这给我们带来了一些问题,因为我们的某些报告花费了超过2分钟的时间,因此,由于2分钟后DB Server没有响应,因此JMS的连接被断开了.

This has caused us some problems because some of our reports take longer than 2 minutes, and as such, the connection is dropped at the JMS because there is no response from the DB Server after 2 minutes.

但是,查询仍在DB Server中运行,查询完成约20分钟后,它尝试返回结果,但由于连接已断开而无法返回结果.

However, the query is still running in the DB Server, and after about 20 minutes when the query completes, it tries to return the result but is not able to because the connection is already dropped.

下面是我们正在调用的方法

Below is the method that we are calling

 public void generateReport(long ticketID, long inst_data_id, boolean flag)
        throws AppException, InformationalException {

    Trace.kToolsLogger.info("*********** Report generation started ******");

    if(Configuration.runningInAppServer()){
        try {

            Trace.kToolsLogger.info("*********** Transaction timeout set to 1200 ******");

            InitialContext ctx = new InitialContext();               
            UserTransaction tx = (UserTransaction)ctx.lookup("java:comp/UserTransaction");
            tx.setTransactionTimeout(1200);

        } catch (SystemException e) {           
            e.printStackTrace();
        } catch (Exception e) { 
            e.printStackTrace();
        }
     } else{

         Trace.kToolsLogger.info("Not running in app server. Timeout not set to 120");
     }

但是,以上设置仍然无法使用,我的方法仍在2分钟后超时.

However, the above setting is still not working and my method is still timing out at 2 minutes.

这是2分钟后我总是遇到的错误:

This is the error that I always encounter after 2 minutes:

[4/20/16 12:56:06:105 SGT] 00000122超时管理I WTRN0006W:事务Curam#coreinf-ejb.jar#DPEnactmentMDB 000001543204A61800000001478C576857C2F09B4365FB74A6A3A28FED806D44107D7CBC00000A4A4F43C6A43C76A43C76A43C76A43C76A43C76A43C76A3F1F0C0F86A4F0F0C0F54C04A0F0F0C1160C4F0C54A0F0C1160C4F3C [4/20/16 12:56:06:108 SGT] 00000122 TimeoutManage I WTRN0124I:发生超时时,与事务关联或最近关联的线程是Thread [SIBJMSRAThreadPool:1,5,main].发生超时时此线程的堆栈跟踪为:

[4/20/16 12:56:06:105 SGT] 00000122 TimeoutManage I WTRN0006W: Transaction Curam#coreinf-ejb.jar#DPEnactmentMDB 000001543204A61800000001478C576857C2F09B4365FB74A6A3A28FED806D44107D7CBC000001543204A61800000001478C576857C2F09B4365FB74A6A3A28FED806D44107D7CBC00000001 has timed out after 120 seconds. [4/20/16 12:56:06:108 SGT] 00000122 TimeoutManage I WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently, associated was Thread[SIBJMSRAThreadPool : 1,5,main]. The stack trace of this thread when the timeout occurred was:

我们已经进行了调查,并且知道我们可以配置另一个JMS.但是,我们如何能够从该方法中调出特定的JMS?另外,还有其他方法可以覆盖Websphere中的事务超时吗?

We have investigated and know that we can configure another JMS. But how will we be able to call out that particular JMS from the method? Also, is there any other way to overwrite the Transaction Timeout in Websphere?

赞赏任何形式的回应.谢谢你.如果您需要其他任何信息,请告诉我.

Appreciate any kind of response. Thank you. Please let me know if you require any other information.

我知道能够在WebSphere级别上更新事务超时,但是我们希望将其保留2分钟,因为我们只希望此特定方法具有延长的超时.谢谢! :)

I am aware of being able to update the Transaction Timeout at WebSphere level, but we are hoping to leave it at 2 minutes as we just want this particular method to have an extended timeout. Thanks! :)

推荐答案

您在UserTransaction.setTransactionTimeout()上指定的事务超时值应受最大事务超时约束,但不受总事务生存时间超时约束,因此您需要如果您希望应用程序能够将事务超时设置为1200秒,则将前者增加到至少1200秒,而后者可以保持较小的值,并且在应用程序未指定事务超时的情况下继续应用.这些设置的说明可在此知识中心文档中找到,

The transaction timeout value that you specify on UserTransaction.setTransactionTimeout() should be constrained by the Maximum Transaction Timeout, but not by the Total Transaction Lifetime Timeout, so you would need to increase the former to at least 1200 seconds if you want the application to be able to set the transaction timeout to 1200 seconds, whereas the latter can remain at a lesser value, and would continue to apply where the application does not specify a transaction timeout. Descriptions of these settings are found in this knowledge center doc,

还应注意,UserTransaction.setTransactionTimeout()应该在开始事务之前被调用,并且仅适用于将在同一线程上运行的事务,因此您将需要验证您的应用程序是否以此方式使用它

It should also be noted that UserTransaction.setTransactionTimeout() should be invoked before beginning the transaction, and only applies to the transaction that will run on the same thread, so you'll want to verify that your application is using it in this manner.

如果您已经完成上述操作,而产品的性能有所不同,我建议您在IBM支持下开箱.

If you have already done the above and the product is behaving differently, I would suggest opening a case with IBM support.

这篇关于是否覆盖WebSphere设置的事务超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆