jboss cli用于修改default-workmanager

时间:2018-10-24 08:28:41

标签: java jboss command-line-interface

有问题的子系统是:

<subsystem xmlns="urn:jboss:domain:jca:1.1">
<archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
<bean-validation enabled="true"/>
<default-workmanager>
 <short-running-threads>
  <core-threads count="50"/>
  <queue-length count="50"/>
  <max-threads count="50"/>
  <keepalive-time time="10" unit="seconds"/>
 </short-running-threads>
 <long-running-threads>
  <core-threads count="50"/>
  <queue-length count="50"/>
  <max-threads count="50"/>
  <keepalive-time time="10" unit="seconds"/>
 </long-running-threads>
</default-workmanager>
<cached-connection-manager/>
</subsystem>

我想使用jboss cli修改3个属性:<short-running-threads><long-running-threads>下的核心线程数,队列长度数和最大线程数。

任何人都可以提供cli来修改这些属性吗?

2 个答案:

答案 0 :(得分:2)

我想您想更改默认值,而不是计数。计数器是用于监视的实际值,并非旨在设置。

在JBoss jboss-cli目录中尝试bin

1。)呼叫./jboss-cli.sh -c。 CLI支持在命令的每个部分上执行上下文相关的命令。

2。)呼叫./jboss-cli.sh --gui。使用GUI导航到JCA子系统,直至所需的属性。您可以使用write-attribute上下文菜单项单击鼠标来更改它。设置新值后,匹配的CLI命令将显示在GUI顶部的文本字段中,准备进行复制/粘贴。

这是设置默认值的示例:

/subsystem=jca/workmanager=default/long-running-threads=default/:write-attribute(name=core-threads,value=200)

答案 1 :(得分:1)

正如@Frito所建议的那样,最终的CLI如下所示:

# Batch script to modify thread count configuration in the JBoss server

# Connect to JBoss
connect

# Start batching commands
batch

#Modify short-running-threads
/subsystem=jca/workmanager=default/short-running-threads=default/:write-attribute(name=core-threads,value=200)
/subsystem=jca/workmanager=default/short-running-threads=default/:write-attribute(name=queue-length,value=200)
/subsystem=jca/workmanager=default/short-running-threads=default/:write-attribute(name=max-threads,value=200)

#Modify long-running-threads
/subsystem=jca/workmanager=default/long-running-threads=default/:write-attribute(name=core-threads,value=200)
/subsystem=jca/workmanager=default/long-running-threads=default/:write-attribute(name=queue-length,value=200)
/subsystem=jca/workmanager=default/long-running-threads=default/:write-attribute(name=max-threads,value=200)

# Reload to appy changes
:reload

# Run the batch commands
run-batch
执行cli后的

Standalone.xml代码段:

<subsystem xmlns="urn:jboss:domain:jca:1.1">
<archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
<bean-validation enabled="true"/>
<default-workmanager>
 <short-running-threads>
  <core-threads count="200"/>
  <queue-length count="200"/>
  <max-threads count="200"/>
  <keepalive-time time="10" unit="seconds"/>
 </short-running-threads>
 <long-running-threads>
  <core-threads count="200"/>
  <queue-length count="200"/>
  <max-threads count="200"/>
  <keepalive-time time="10" unit="seconds"/>
 </long-running-rhreads>
</default-workmanager>
<cached-connection-manager/>
</subsystem>