Thursday, March 31, 2011

Keep the Admin Console Open

The WAS Admin Console times out in 30 minutes - very inconvenient.
You can use this Jython program to change the time out value or modify the file directly. (this code will not work unless you fix the indention that is meaningful to Jython. I cannot get this blog editor to do indention easily)

# This progam extends the time out value for WAS admin console
__author__="IBM Red Book Authors"
__date__ ="$Jan 28, 2011 8:55:48 AM$"
dep = AdminConfig.getid("/Deployment:isclite/" )
appDep = AdminConfig.list("ApplicationDeployment", dep )
sesMgmt = AdminConfig.list("SessionManager", appDep )
# check if existing sesMgmt there or not, if not then create a new one, if
# exist then modify it
if (sesMgmt == ""):
    # get applicationConfig to create new SessionManager
    appConfig = AdminConfig.list("ApplicationConfig", appDep )
    if (appConfig == ""):
        # create a new one
        appConfig = AdminConfig.create("ApplicationConfig", appDep, [])
        # then create a new SessionManager using new Application Config
        sesMgmt = AdminConfig.create("SessionManager", appConfig, [] )
    else:
        # create new SessionManager using the existing ApplicationConfig
        sesMgmt = AdminConfig.create("SessionManager", appConfig, [] )
        # endElse
# endIf
# get tuningParams config id
tuningParams = AdminConfig.showAttribute(sesMgmt, "tuningParams" )
if (tuningParams == ""):
    # create a new tuningParams
    AdminConfig.create("TuningParams", sesMgmt, [["invalidationTimeout", 1420]])
else:
    # modify the existing one
    AdminConfig.modify(tuningParams, [["invalidationTimeout", 1420]] )
    # endElse
# saving the configuration changes
AdminConfig.save()

No comments: