The scenario is that I want to create a Work Manager at a particular scope, using Jython.

This article discusses the process of how I learned the syntax for this requirement and is to be part of my Jython course.

Determine Syntax

Using wsadmin help commands and on-disk XML from a WebSphere installation, I was able to discover the available commands I used in my Jython class below.

Deducing by looking at XML

By looking at existing XML in the installed WASND configuration located within the DMGR’s config folders we can see the information below which can help us deduce the correct syntax required.

In the examples below I have added the cell’s resources-pme.xml file as seen in this table…

/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/batrounCell01
<workmanager:WorkManagerProvider xmi:id=”WorkManagerProvider_1″ name=”WorkManagerProvider” description=”Default WorkManager Provider”>
<factories xmi:type=”workmanager:WorkManagerInfo” xmi:id=”WorkManagerInfo_Default” name=”DefaultWorkManager” jndiName=”wm/default” description=”WebSphere Default WorkManager” category=”Default” numAlarmThreads=”5″ minThreads=”1″ maxThreads=”10″ threadPriority=”5″ isGrowable=”false”>
<serviceNames>AppProfileService</serviceNames>
<serviceNames>com.ibm.ws.i18n</serviceNames>
<serviceNames>security</serviceNames>
<serviceNames>UserWorkArea</serviceNames>
<serviceNames>zos.wlm</serviceNames>
</factories>
</workmanager:WorkManagerProvider>
<workmanager:TimerManagerProvider xmi:id=”TimerManagerProvider_1″ name=”TimerManagerProvider” description=”Default TimerManager Provider” >
<factories xmi:type=”workmanager:TimerManagerInfo” xmi:id=”TimerManagerInfo_Default” name=”DefaultTimerManager” jndiName=”tm/default” description=”WebSphere Default TimerManager”/>
</workmanager:TimerManagerProvider>
<scheduler:SchedulerProvider xmi:id=”SchedulerProvider_1″ name=”SchedulerProvider” description=”Default Scheduler Provider”>
</scheduler:SchedulerProvider>

Below we have the listing of an exiting manually created work manager called myWorkManager which was created through the Administrative console.

/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/batrounCell01/clusters/Cluster01
<?xml version=”1.0″ encoding=”UTF-8″?>
<xmi:XMI xmi:version=”2.0″ xmlns:xmi=”http://www.omg.org/XMI” xmlns:objectpoolmanager=”http://www.ibm.com/websphere/appserver/schemas/5.0/objectpoolmanager.xmi” xmlns:scheduler=”http://www.ibm.com/websphere/appserver/schemas/5.0/scheduler.xmi” xmlns:workmanager=”http://www.ibm.com/websphere/appserver/schemas/5.0/workmanager.xmi”>
<objectpoolmanager:ObjectPoolProvider xmi:id=”ObjectPoolProvider_1″ name=”ObjectPoolProvider” description=”Default Object Pool Provider”/>
<workmanager:WorkManagerProvider xmi:id=”WorkManagerProvider_1” name=”WorkManagerProvider” description=”Default WorkManager Provider”>
<factories xmi:type=”workmanager:WorkManagerInfo” xmi:id=”WorkManagerInfo_Default” name=”DefaultWorkManager” jndiName=”wm/default” description=”WebSphere Default WorkManager” category=”Default” minThreads=”1″ maxThreads=”10″ threadPriority=”5″ numAlarmThreads=”5″ isGrowable=”false”>
<serviceNames>AppProfileService</serviceNames>
<serviceNames>com.ibm.ws.i18n</serviceNames>
<serviceNames>security</serviceNames>
<serviceNames>UserWorkArea</serviceNames>
<serviceNames>zos.wlm</serviceNames>
</factories>
<factories xmi:type=”workmanager:WorkManagerInfo” xmi:id=”WorkManagerInfo_ARD” name=”AsyncRequestDispatcherWorkManager” jndiName=”wm/ard” minThreads=”1″ maxThreads=”50″ threadPriority=”5″ numAlarmThreads=”5″ isGrowable=”false” workTimeout=”10000″ workReqQFullAction=”1″>
<serviceNames>UserWorkArea</serviceNames>
<serviceNames>security</serviceNames>

<serviceNames>AppProfileService</serviceNames>

<serviceNames>com.ibm.ws.i18n</serviceNames>

<serviceNames>zos.wlm</serviceNames>

</factories>


<factories xmi:type=”workmanager:WorkManagerInfo” xmi:id=”WorkManagerInfo_1337505812122″ name=”myWorkManager” jndiName=”wm/myWorkManager” description=”Description for My Work Manager” category=”P2P” minThreads=”0″ maxThreads=”100″ threadPriority=”5″ numAlarmThreads=”5″ isGrowable=”true” workTimeout=”1000″ workReqQFullAction=”1″ isDistributable=”true”>

<serviceNames>com.ibm.ws.i18n</serviceNames>

<serviceNames>security</serviceNames>

<serviceNames>UserWorkArea</serviceNames>

<serviceNames>zos.wlm</serviceNames>

</factories>

</workmanager:WorkManagerProvider>

<workmanager:TimerManagerProvider xmi:id=”TimerManagerProvider_1″ name=”TimerManagerProvider” description=”Default TimerManager Provider”>

<factories xmi:type=”workmanager:TimerManagerInfo” xmi:id=”TimerManagerInfo_Default” name=”DefaultTimerManager” jndiName=”tm/default” description=”WebSphere Default TimerManager”/>

</workmanager:TimerManagerProvider>

<scheduler:SchedulerProvider xmi:id=”SchedulerProvider_1″ name=”SchedulerProvider” description=”Default Scheduler Provider”/>

</xmi:XMI>


Deduce by looking at Help

Shell script
#———–log4jtest.sh———–
#!/bin/sh
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/wsadmin.sh -username wasadmin -password wasadmin -c “print AdminConfig.attributes(‘WorkManagerProvider’).splitlines();”
echo “Exit status=” $?
Result
root@batroun workManager]# ./getWMProviderHelp.sh
WASX7209I: Connected to process “dmgr” on node batrounCellManager01 using SOAP connector; The type of process is: DeploymentManager
[‘classpath String*’, ‘description String’, ‘isolatedClassLoader boolean’, ‘name String’, ‘nativepath String*’, ‘propertySet J2EEResourcePropertySet’, ‘providerType String’, ‘referenceables Referenceable*’]
Exit status= 0
Shell script
#———–getWMInfoHelp.sh———–
#!/bin/sh
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/wsadmin.sh -username wasadmin -password wasadmin -c “print AdminConfig.attributes(‘WorkManagerInfo’).splitlines();”
echo “Exit status=” $?
Result
[root@batroun workManager]# ./getWMInfoHelp.sh
WASX7209I: Connected to process “dmgr” on node batrounCellManager01 using SOAP connector; The type of process is: DeploymentManager
[‘category String’, ‘daemonTranClass String’, ‘defTranClass String’, ‘description String’, ‘isDistributable boolean’, ‘isGrowable boolean’, ‘jndiName String’, ‘maxThreads int’, ‘minThreads int’, ‘name String’, ‘numAlarmThreads int’, ‘propertySet J2EEResourcePropertySet’, ‘provider J2EEResourceProvider@’, ‘providerType String’, ‘referenceable Referenceable@’, ‘serviceNames String*’, ‘threadPriority int’, ‘workReqQFullAction int’, ‘workReqQSize int’, ‘workTimeout int’]
Exit status= 0

The code to create and or modify a WorkLoad Manager

Shell Script to launch test of class
#———–manageWorkManager.sh———–
#!/bin/sh
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/wsadmin.sh -password wasadmin -username wasadmin -f /var/stever/workManager/manageWorkManager.py
echo “Exit status=” $?

from org.apache.log4j import Logger
from org.apache.log4j import PropertyConfigurator
global logger

# Create a WorkManager at a specific scope. 
# We could use any of the other scopes as long as it is at the same 
# or higher than the Scheduler's scope if you wish to use the WM for a scheduler

#using a lookup we need to get the Id of the existing Workload manager so we can delete it and re-install
#AdminConfig.remove('(cells/batrounCell01/clusters/Cluster01|resources-pme.xml#WorkManagerInfo_1337373533774)') 
class WorkManager :
    __wrkMgrProv = None
    __wrkMgrInfo = None
    __scope = None
    __cellName = None
    __clusterName = None
    __nodeName = None
    __serverName = None

    #WorkManagerInfo specfic instance variables
    __category ="P2P" #String
    __daemonTranClass = "" #String
    __defTranClass = "" #String
    __description  = "Description for My Work Manager" #String
    __isDistributable ="true" #boolean
    __isGrowable ="true" #boolean
    __jndiName  = "wm/myWorkManager" #String
    __maxThreads  = "100" #int
    __minThreads  = "10" #int
    __name ="My Work Manager" #String
    __numAlarmThreads  = "5" #int
    #__propertySet J2EEResourcePropertySet
    #__provider J2EEResourceProvider@
    #__providerType = "" #String
    #__referenceable Referenceable@
    __serviceNames  = "com.ibm.ws.i18n;security;UserWorkArea" #String*
    __threadPriority ="5" #int
    __workReqQFullAction ="1" #int 1 = falil, block = 0
    __workReqQSize = "0" #int, default is 0
    __workTimeout  = "1000" #int

    #-------------------------------------------------------------------------------------
    #Constructor
    #-------------------------------------------------------------------------------------
    def __init__(self,*args) :
        #ensure we know we are using a global var.
        global logger
        PropertyConfigurator.configure('/var/stever/workManager/log4j.properties')
        logger = Logger.getLogger("Work Manager")
        #use the config data in the properties file
        logger.info("Instantiated a Work Manager Object")
    #endDef

    #-------------------------------------------------------------------------------------
    #Class Setter Methods ...
    #-------------------------------------------------------------------------------------
    def setCategory(self, valueVariable) :
        print "METHOD: setCategory"
        self.__category = valueVariable;
    #endDef

    def setDaemonTranClass(self, valueVariable) :
        print "METHOD: setDaemonTranClass"
        self.__daemonTranClass = valueVariable;
    #endDef

    def setDefTranClass(self, valueVariable) :
        print "METHOD: setDefTranClass"
        self.__defTranClass = valueVariable;
    #endDef

    def setDescription(self, valueVariable) :
        print "METHOD: setDescription"
        self.__description = valueVariable;
    #endDef

    def setIsDistributable(self, valueVariable) :
        print "METHOD: setIsDistributable"
        self.__isDistributable = valueVariable;
    #endDef


    def setIsGrowable(self, valueVariable) :
        print "METHOD: setIsGrowable"
        self.__isGrowable = valueVariable;
    #endDef


    def setJndiName(self, valueVariable) :
        print "METHOD: setJndiName"
        self.__jndiName = valueVariable;
    #endDef

    def setMinThreads(self, valueVariable) :
        print "METHOD: setMinThreads"
        self.__minThreads = valueVariable;
    #endDef

    def setMaxThreads(self, valueVariable) :
        print "METHOD: setMaxThreads"
        self.__maxThreads = valueVariable;
    #endDef

    def setName(self, valueVariable) :
        print "METHOD: setName"
        self.__name = valueVariable;
    #endDef

    def setNumAlarmThreads(self, valueVariable) :
        print "METHOD: setNumAlarmThreads"
        self.__numAlarmThreads = valueVariable;
    #endDef

    def setServiceNames(self, valueVariable) :
        print "METHOD: setServiceNames"
        self.__serviceNames = valueVariable;
    #endDef

    def setThreadPriority(self, valueVariable) :
        print "METHOD: setThreadPriority"
        self.__threadPriority = valueVariable;
    #endDef

    def setWorkReqQFullAction(self, valueVariable) :
        print "METHOD: setWorkReqQFullAction"
        self.__workReqQFullAction = valueVariable;
    #endDef

    def setWorkReqQSize(self, valueVariable) :
        print "METHOD: setWorkReqQSize"
        self.__workReqQSize = valueVariable;
    #endDef

    def setWorkTimeout(self, valueVariable) :
        print "METHOD: setWorkTimeout"
        self.__workTimeout = valueVariable;
    #endDef

    #-------------------------------------------------------------------------------------
    #decision tree Method...
    #-------------------------------------------------------------------------------------
    def setCellScope(self, cellName) :
        print "METHOD: setCellScope"
        self.__scope = "cell";
        self.__cellName = cellName;
    #endDef

    def setNodeScope(self, nodeName) :
        print "METHOD: setNodeScope"
        self.__scope = "node";
        self.__nodeName = nodeName;
    #endDef

    def setClusterScope(self, clusterName) :
        logger.debug( "METHOD: setClusterScope")
        self.__scope = "cluster";
        logger.debug("self.__scope=" + self.__scope)
        self.__clusterName = clusterName;
        logger.debug("self.__clusterName=" + self.__clusterName)
        
    #endDef

    def setServerScope(self, nodeName, serverName) :
        print "METHOD: setServerScope"
        self.__scope = "server";
        self.__nodeName = nodeName;
        self.__serverName = serverName;
    #endDef

    #-------------------------------------------------------------------------------------
    #getAttribute Method...
    #-------------------------------------------------------------------------------------
    def getAttributes(self) :
        attrib = ""
        if(self.__category) != None:
            attrib += "[" + "category " + '"' + self.__category + '"' + "] " 
        if(self.__description) != None:
            attrib += "[" + "description " + '"' + self.__description + '"' + "] "
        if(self.__isDistributable) != None:
            attrib += "[" + "isDistributable "+ '"' +  self.__isDistributable+ '"' +  "] "
        if(self.__isGrowable) != None:
            attrib += "[" + "isGrowable "+ '"' +  self.__isGrowable + '"' + "] "
        if(self.__jndiName) != None:
            attrib += "[" + "jndiName " + '"' + self.__jndiName + '"' + "] "
        if(self.__maxThreads) != None:
            attrib += "[" + "maxThreads "+ '"' +  self.__maxThreads + '"' + "] "
        if(self.__minThreads) != None:
            attrib += "[" + "minThreads "+ '"' +  self.__minThreads + '"' + "] "
        if(self.__name) != None:
            attrib += "[" + "name "+ '"' +  self.__name + '"' + "] "
        if(self.__numAlarmThreads) != None:
            attrib += "[" + "numAlarmThreads "+ '"' + self.__numAlarmThreads + '"' + "] "
        if(self.__serviceNames) != None:
            attrib += "[" + "serviceNames " + '"' + self.__serviceNames+ '"' +  "] "
        if(self.__threadPriority) != None:
            attrib += "[" + "threadPriority "+ '"' + self.__threadPriority + '"' + "] "
        if(self.__workReqQFullAction) != None:
            attrib += "[" + "workReqQFullAction "+ '"' + self.__workReqQFullAction + '"' + "] "
        if(self.__workReqQSize) != None:
            attrib += "[" + "workReqQSize "+ '"' + self.__workReqQSize + '"' + "] "
        if(self.__workTimeout) != None:
            attrib += "[" + "workTimeout " + '"' + self.__workTimeout + '"' + "]"
        return "[" + attrib + "]"
    #endDef
    
    #--------------------------------------------------------------------------------------
    #setWMProvider() #Internal do not call from outside this class, used by CRUD functions.
    #--------------------------------------------------------------------------------------
    def workManagerExists(self) :
        logger.debug( "ENTER workManagerExists()")
        returnVal = 0
        self.setWMInfo()
        logger.debug("beanId(s) = " + self.__wrkMgrInfo)
        workManagers = self.__wrkMgrInfo.splitlines()
        for workManager in workManagers :
            logger.info("found workManager" + workManager)
            returnVal = 1
            logger.debug( "EXIT workManagerExists()")
            break
        #endFor
        
        logger.debug( "EXIT workManagerExists()")
        return returnVal
        
    #endDef
    
    #--------------------------------------------------------------------------------------
    #setWMProvider() #Internal do not call from outside this class, used by CRUD functions.
    #--------------------------------------------------------------------------------------
    def setWMProvider(self) :
        logger.debug( "ENTER setWMProvider()")
        #Decide which scope in whch the work manager is being created
        
        if((self.__cellName == "") or (self.__cellName == None)) :
            self.__cellName = AdminControl.getCell()
            logger.warn("setCellName method was not called, assuming current cell")
        #endIf

        if (cmp(self.__scope,"cell") ==0) :
            logger.debug("Creating a cell scoped beanId with these values:")
            logger.debug("self.__cellName=" + self.__cellName)
            beanId = '/Cell:' + self.__cellName + '/WorkManagerProvider:WorkManagerProvider'
            beanObjectId = AdminConfig.getid(beanId)
            logger.debug("beanObjectId=" + beanObjectId)
            self.__wrkMgrProv = beanObjectId
        elif (cmp(self.__scope,"node") ==0) :
            logger.debug("Creating a node scoped beanId with these values:")
            logger.debug("self.__cellName=" + self.__cellName)
            logger.debug("self.__nodeName=" + self.__nodeName)
            beanId = '/Cell:' + self.__cellName + '/Node:' + self.__nodeName +'/WorkManagerProvider:WorkManagerProvider'
            logger.debug("beanId=" + beanId)
            beanObjectId = AdminConfig.getid(beanId)
            logger.debug("beanObjectId=" + beanObjectId)
            self.__wrkMgrProv = beanObjectId
        elif (cmp(self.__scope,"cluster") ==0) :
            logger.debug("Creating a cluster scoped beanId with these values:")
            logger.debug("self.__cellName=" + self.__cellName)
            logger.debug("self.__clusterName=" + self.__clusterName)
            beanId = '/Cell:' + self.__cellName + '/ServerCluster:' + self.__clusterName + '/WorkManagerProvider:WorkManagerProvider'
            beanObjectId = AdminConfig.getid(beanId)
            logger.debug("beanObjectId=" + beanObjectId)
            self.__wrkMgrProv = beanObjectId
        elif (cmp(self.__scope,"server") ==0) :
            logger.debug("Creating a server scoped beanId with these values:")
            logger.debug("self.__cellName=" + self.__cellName)
            logger.debug("self.__nodeName=" + self.__nodeName)
            logger.debug("self.__serverName=" + self.__serverName)
            logger.debug("self.__name=" + self.__name)
            beanId = '/Cell:' + self.__cellName + '/Node:' + self.__nodeName + '/Server:' + self.__serverName + '/WorkManagerProvider:WorkManagerProvider'
            beanObjectId = AdminConfig.getid(beanId)
            logger.debug("beanObjectId=" + beanObjectId)
            self.__wrkMgrProv = beanObjectId
        else :
            
             logger.Error("Scope is not set, please call set[type]Scope methods first.")
             sys.exit(0)
        #endIf

        if (len(self.__wrkMgrProv) == 0) :
            logger.error("Unable to find the WorkManagerProvider for scope "  + self.__scope + " Aborting.")
            logger.debug( "EXIT setWMProvider()")
            sys.exit(0)
        else :
            logger.debug("Found a work manager provider:") 
            logger.debug(self.__wrkMgrProv)
        #endIf#
        logger.debug( "EXIT setWMProvider()")
    #endDef
    
    #--------------------------------------------------------------------------------------
    #setWMProvider() #Internal do not call from outside this class, used by CRUD functions.
    #--------------------------------------------------------------------------------------
    def setWMInfo(self) :
        logger.debug( "ENTER setWMInfo()")
        #Decide which scope in whch the work manager is being created
        
        if((self.__cellName == "") or (self.__cellName == None)) :
            self.__cellName = AdminControl.getCell()
            logger.warn("setCellName method was not called, assuming current cell")
        #endIf

        if (cmp(self.__scope,"cell") ==0) :
            logger.debug("Creating a cell scoped beanId with these values:")
            logger.debug("self.__cellName=" + self.__cellName)
            logger.debug("self.__name=" + self.__name)
            beanId = '/Cell:' + self.__cellName + '/WorkManagerInfo:' + self.__name
            logger.debug("beanId=" + beanId)
            beanObjectId = AdminConfig.getid(beanId)
            logger.debug("beanObjectId=" + beanObjectId)
            self.__wrkMgrInfo = beanObjectId
        elif (cmp(self.__scope,"node") ==0) :
            logger.debug("Creating a node scoped beanId with these values:")
            logger.debug("self.__cellName=" + self.__cellName)
            logger.debug("self.__nodeName=" + self.__nodeName)
            logger.debug("self.__name=" + self.__name)
            beanId = '/Cell:' + self.__cellName + '/Node:' + self.__nodeName + '/WorkManagerProvider:WorkManagerProvider/WorkManagerInfo:' + self.__name
            logger.debug("beanId=" + beanId)
            beanObjectId = AdminConfig.getid(beanId)
            logger.debug("beanObjectId=" + beanObjectId)
            self.__wrkMgrInfo = beanObjectId
        elif (cmp(self.__scope,"cluster") ==0) :
            logger.debug("Creating a cluster scoped beanId with these values:")
            logger.debug("self.__cellName=" + self.__cellName)
            logger.debug("self.__clusterName=" + self.__clusterName)
            logger.debug("self.__name=" + self.__name)
            beanId = '/Cell:' + self.__cellName + '/ServerCluster:' + self.__clusterName + '/WorkManagerProvider:WorkManagerProvider/WorkManagerInfo:' + self.__name
            logger.debug("beanId=" + beanId)
            beanObjectId = AdminConfig.getid(beanId)
            logger.debug("beanObjectId=" + beanObjectId)
            self.__wrkMgrInfo = beanObjectId
        elif (cmp(self.__scope,"server") ==0) :
            logger.debug("Creating a server coped beanId with these values:")
            logger.debug("self.__cellName=" + self.__cellName)
            logger.debug("self.__nodeName=" + self.__nodeName)
            logger.debug("self.__serverName=" + self.__serverName)
            logger.debug("self.__name=" + self.__name)
            beanId = '/Cell:' + self.__cellName + '/Node:' + self.__nodeName + '/Server:' + self.__serverName + '/WorkManagerProvider:WorkManagerProvider/WorkManagerInfo:' + self.__name
            logger.debug("beanId=" + beanId)
            beanObjectId = AdminConfig.getid(beanId)
            logger.debug("beanObjectId=" + beanObjectId)
            self.__wrkMgrInfo = beanObjectId
        else :
            
             logger.Error("Scope is not set, please call set[type]Scope methods first.")
             logger.debug( "EXIT setWMInfo()")
             sys.exit(0)
        #endIf
        logger.debug( "EXIT setWMInfo()")
    #endDef

    #-------------------------------------------------------------------------------------
    #Modify Method...
    #-------------------------------------------------------------------------------------
    def modify(self) :
        logger.debug( "ENTER modify()")
        #We set up a pointer to an existing work manager, we dno not need to know about th ework manager provider to do this.
        #The work ManagerProvider is our parent object.
        self.setWMInfo()
        logger.info( "modify WorkManager: Modifying attributes: " + self.getAttributes())
        AdminConfig.modify(self.__wrkMgrInfo, self.getAttributes())
        logger.info( "modify WorkManager: Saving configuration after setting new attributes")
        AdminConfig.save()
        logger.info( "modify WorkManager: executed successfully")
        logger.debug( "EXIT modify()")
     #endDef

    #-------------------------------------------------------------------------------------
    #Create Method...
    #-------------------------------------------------------------------------------------
    def create(self) :
        logger.debug( "ENTER create()")
        #We set up a pointer to a work manager provider as we are adding a new child object.
        if(self.workManagerExists()==0) :
            self.setWMProvider()
            logger.info( "create WorkManager: create attributes: " + self.getAttributes())
            AdminConfig.create( 'WorkManagerInfo', self.__wrkMgrProv, self.getAttributes())
            logger.info( "create WorkManager: Saving configuration after setting new attributes")
            AdminConfig.save()
            logger.info( "createWorkManager: created successfully")
        else :
            logger.warn("WorkManager [" + self.__name + " ] for scope [" + self.__scope + "] already exists, modifying exiting entry")
            self.modify()
        #endElse
        logger.debug( "EXIT create()")
    #endDef

    def list(self) :
        logger.debug( "ENTER list()")
        self.setWMInfo()
        #workManagers = AdminConfig.getid("/Cell:batrounCell01/ServerCluster:Cluster01/WorkManagerProvider:WorkManagerProvider/WorkManagerInfo:myWorkManager").splitlines()
        logger.debug("beanId(s) = " + self.__wrkMgrInfo)
        workManagers = self.__wrkMgrInfo.splitlines()
        for workManager in workManagers :
            logger.info("workManager=" + workManager)
        #endFor
        logger.debug( "EXIT list()")
        
    #endDef
#endClass

#########################################################
################# MAIN ENTRY POINT ######################
#########################################################

#Exampe of how to  use the class above
wm = WorkManager()
wm.setName('myWorkManager')
wm.setIsGrowable('true')
wm.setJndiName('wm/myWorkManager')
wm.setMaxThreads("100")
wm.setMinThreads("1")
wm.setNumAlarmThreads("5")
wm.setWorkReqQFullAction("0")
#wm.setCellScope("batrounCell01")
#wm.setNodeScope("batrounNode01")
wm.setServerScope("batrounNode01", "Server01")
#wm.setClusterScope("Cluster01")
wm.create()
#wm.modify()
wm.list()
#=====================================================================================
# Reference ie Help  
#=====================================================================================
#Basically configuring a work manager is a little tricky, how did I get the syntax?
#the command below gets the WorkManagerInfo
#print AdminConfig.attributes('WorkManagerInfo')
'''wsadmin>print AdminConfig.attributes('WorkManagerInfo')
category String
daemonTranClass String
defTranClass String
description String
isDistributable boolean
isGrowable boolean
jndiName String
maxThreads int
minThreads int
name String
numAlarmThreads int
propertySet J2EEResourcePropertySet
provider J2EEResourceProvider@
providerType String
referenceable Referenceable@
serviceNames String*
threadPriority int
workReqQFullAction int
workReqQSize int
workTimeout int'''

Example output in Log4j log

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply