使用脚本编制配置运行时事务服务

使用 wsadmin 工具配置服务器的事务属性。事务服务是服务器运行时组件,可以协调对多个资源管理器进行的更新以确保进行原子数据更新。由应用程序或部署应用程序的容器开始和结束事务。

关于此任务

有两种方式可用来执行本任务。通过本任务中的步骤来使用 AdminControl 对象,以修改事务服务配置。或者,可以使用 AdminServerManagement 脚本库中的 configureTransactionService Jython 脚本来配置事务服务配置属性。可以使用 configureRuntimeTransactionService 来更新事务服务 MBean 属性。wsadmin 工具启动时将自动装入脚本。

通过以下语法使用 configureTransactionService 脚本来配置事务服务设置:
AdminServerManagement.configureTransactionService(nodeName, serverName, totalTranLifetimeTimeout, clientInactivityTimeout, 
  maximumTransactionTimeout, heuristicRetryLimit, heuristicRetryWait, propogatedOrBMTTranLifetimeTimeout, asyncResponseTimeout,
  otherAttributeList)
通过以下语法使用 configureRuntimeTransactionService 脚本来配置运行时事务服务设置:
AdminServerManagement.configureRuntimeTransactionService(nodeName, serverName, totalTranLifetimeTimeout, 
  clientInactivityTimeout)

有关其他信息和参数定义,请参阅 AdminServerMananagment 脚本库的文档。

过程

  1. 识别应用程序服务器的事务服务 MBean。

    使用 AdminControl 对象的 completeObjectName 命令来返回 server1 服务器的事务服务 MBean 并将其设置为 ts 变量,如下例所示:

    • 使用 Jacl:
      set ts [$AdminControl completeObjectName cell=mycell,node=mynode,
      process=server1,type=TransactionService,*]
    • 使用 Jython:
      ts = AdminControl.completeObjectName('cell=mycell,node=mynode,
      process=server1,type=TransactionService,*')
      print ts
    表 1. completeObjectName 命令中的元素. 此表描述了用于返回先前示例命令中服务器的事务服务 MBean 的元素。
    元素 描述
    set Jacl 命令
    ts 变量名称
    $ 使用其值替换变量名的 Jacl 运算符
    AdminControl 启用运行于服务器进程中的 MBean 的操作的对象
    completeObjectName AdminControl 命令
    cell=mycell,node=mynode,
    process=server1,type=TransactionService
    此命令会返回对象名片段的完整名称。用它来查找匹配的对象名,在这种情况下,它是节点 mynode 的事务对象 MBean,其中 mynode 是您用来使配置更改同步的节点名称。例如:type=TransactionService, process=server1。它可以是域和键属性(例如,类型、名称、单元、节点和进程)的任何有效组合。
    示例输出:
    WebSphere:cell=mycell,name=TransactionService,mbeanIdentifier=TransactionService,
    type=TransactionService,node=mynode,process=server1
  2. 修改运行时事务服务配置属性。
    • 使用 Jacl:
      $AdminControl setAttributes $ts {{clientInactivityTimeout 30} 
      {totalTranLifetimeTimeout 180}}
    • 使用 Jython:
      AdminControl.setAttributes(ts, [['clientInactivityTimeout', 30],
      ['totalTranLifetimeTimeout', 180]])
    下表显示了先前命令中的元素。
    表 2. setAttributes 命令中的元素. 此表描述了 setAttributes 命令中的元素。
    元素 描述
    $ 使用其值替换变量名的 Jacl 运算符
    AdminControl 启用运行于服务器进程中的 MBean 的操作的对象
    setAttributes AdminControl 命令
    ts 对相关事务服务的标识所求的值
    clientInactivityTimeout 一个属性
    30 是以秒计的 clientInactivityTimeout 属性的值。值 0 意味着没有超时限制。
    totalTranLifetimeTimeout 一个属性
    180 是以秒计的 totalTranLifetimeTimeout 属性的值。值 0 意味着没有超时限制。

指示主题类型的图标 任务主题



时间戳记图标 最近一次更新时间: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_transaction
文件名:txml_transaction.html