WebSphere7,使用jython的会话超时
是否可以通过jython脚本设置应用程序会话超时(即映像)WebSphere7,使用jython的会话超时,websphere,jython,Websphere,Jython,是否可以通过jython脚本设置应用程序会话超时(即映像) 是的,您需要使用AdminConfig创建以下对象序列: 查找模块的WebModuleDeployment 在WebModuleDeployment下查找或创建WebModuleConfig子对象 在WebModuleConfig下查找或创建SessionManager子对象 在SessionManager下查找或创建TuningParams子对象 设置TuningParams对象的maxInMemorySessionCount属性 我
是的,您需要使用
AdminConfig
创建以下对象序列:
WebModuleDeployment
WebModuleDeployment
下查找或创建WebModuleConfig
子对象WebModuleConfig
下查找或创建SessionManager
子对象SessionManager
下查找或创建TuningParams
子对象TuningParams
对象的maxInMemorySessionCount
属性set appName myApp
set modName myWeb.war
set maxInMemorySessionCount 1000
# Find the WebModuleDeployment.
set appDepl [$AdminConfig getid /Deployment:$appName/]
foreach webModDepl [$AdminConfig list WebModuleDeployment $appDepl] {
set uri [$AdminConfig showAttribute $webModDepl uri]
if {$uri == $modName} {
# Find or create the WebModuleConfig.
set webModCfg [$AdminConfig list WebModuleConfig $webModDepl]
if {[string length $webModCfg] == 0} {
puts "Adding WebModuleConfig to $webModDepl"
set webModCfg [$AdminConfig create WebModuleConfig $webModDepl {}]
}
# Find or create the SessionManager.
set sessionManager [$AdminConfig list SessionManager $webModCfg]
if {[string length $sessionManager] == 0} {
puts "Adding SessionManager to $webModCfg"
set sessionManager [$AdminConfig create SessionManager $webModCfg {}]
}
# Find or create the TuningParams.
set tuningParams [$AdminConfig list TuningParams $sessionManager]
if {[string length $tuningParams] == 0} {
puts "Adding TuningParams to $sessionManager"
set tuningParams [$AdminConfig create TuningParams $sessionManager {}]
}
# Set the maxInMemorySessionCount parameter.
puts "Setting maxInMemorySessionCount=$maxInMemorySessionCount in $tuningParams"
$AdminConfig modify $tuningParams [list [list maxInMemorySessionCount $maxInMemorySessionCount]]
}
}
$AdminConfig save
是的,您需要使用
AdminConfig
来创建以下对象序列:
WebModuleDeployment
WebModuleDeployment
下查找或创建WebModuleConfig
子对象WebModuleConfig
下查找或创建SessionManager
子对象SessionManager
下查找或创建TuningParams
子对象TuningParams
对象的maxInMemorySessionCount
属性set appName myApp
set modName myWeb.war
set maxInMemorySessionCount 1000
# Find the WebModuleDeployment.
set appDepl [$AdminConfig getid /Deployment:$appName/]
foreach webModDepl [$AdminConfig list WebModuleDeployment $appDepl] {
set uri [$AdminConfig showAttribute $webModDepl uri]
if {$uri == $modName} {
# Find or create the WebModuleConfig.
set webModCfg [$AdminConfig list WebModuleConfig $webModDepl]
if {[string length $webModCfg] == 0} {
puts "Adding WebModuleConfig to $webModDepl"
set webModCfg [$AdminConfig create WebModuleConfig $webModDepl {}]
}
# Find or create the SessionManager.
set sessionManager [$AdminConfig list SessionManager $webModCfg]
if {[string length $sessionManager] == 0} {
puts "Adding SessionManager to $webModCfg"
set sessionManager [$AdminConfig create SessionManager $webModCfg {}]
}
# Find or create the TuningParams.
set tuningParams [$AdminConfig list TuningParams $sessionManager]
if {[string length $tuningParams] == 0} {
puts "Adding TuningParams to $sessionManager"
set tuningParams [$AdminConfig create TuningParams $sessionManager {}]
}
# Set the maxInMemorySessionCount parameter.
puts "Setting maxInMemorySessionCount=$maxInMemorySessionCount in $tuningParams"
$AdminConfig modify $tuningParams [list [list maxInMemorySessionCount $maxInMemorySessionCount]]
}
}
$AdminConfig save
在下面的代码段中,更改节点名称和服务器名称以匹配您自己的名称。使用“InvalizationTimeout”属性指定会话超时(在下面的示例中,它设置为45分钟),还可以指定其他相关属性,如下所示
server = AdminConfig.getid("/Node:was7host01Node01/Server:server1")
sms=AdminConfig.list("SessionManager",server)
AdminConfig.modify(sms,'[[tuningParams [[allowOverflow "true"] [invalidationTimeout "45"] [maxInMemorySessionCount "1000"]]]]')
AdminConfig.save()
在下面的代码段中,更改节点名称和服务器名称以匹配您自己的名称。使用“InvalizationTimeout”属性指定会话超时(在下面的示例中,它设置为45分钟),还可以指定其他相关属性,如下所示
server = AdminConfig.getid("/Node:was7host01Node01/Server:server1")
sms=AdminConfig.list("SessionManager",server)
AdminConfig.modify(sms,'[[tuningParams [[allowOverflow "true"] [invalidationTimeout "45"] [maxInMemorySessionCount "1000"]]]]')
AdminConfig.save()
我只做了一行,但多亏了所有的AdminConfig.create('TuningParams',AdminConfig.create('SessionManager',AdminConfig.create('ApplicationConfig',AdminConfig.list('ApplicationDeployment',AdminConfig.getid('/Deployment:taskspace/'),[]),[[]['invalizationtimeout',40]]),我只做了一行,但多亏了所有的AdminConfig.create('TuningParams',AdminConfig.create('SessionManager',AdminConfig.create('ApplicationConfig',AdminConfig.list('ApplicationDeployment',AdminConfig.getid('/Deployment:taskspace/'),[]),[[[]['invalizationtimeout',40]]))如果答案解决了您的问题,我们鼓励您通过单击答案旁边的复选框来接受它。如果答案解决了您的问题,我们鼓励您通过单击答案旁边的复选框来接受它。