cle_clock
Home > wikikonf >  was/actions/by kikonf > tp







Tp

print

Action : was.tp   (Category : was, Name : tp, By : kikonf)
Complete Name : was.tp.by.kikonf
Version : 5.0        License : Modified BSD License

Purpose of the was category :
Easy to customize. This category use in background the wsadmin command in jython mode (through AdminConfig, AdminControl and AdminTask), to drive WebSphere Application Server ® configuration.
You can use it to manage the whole WebSphere ® architecture.

Purpose of this tp plugin : Tune a Thread Pool

The following shows the main Source Code File for the Action : was.tp

Toggle lines
##  Copyright (c) 2008, Patrick Germain Placidoux
##  All rights reserved.
##
##  This file is part of Kikonf Public Software.
##
##  Kikonf Public Software is released under the modified BSD License,
##  which should accompany it or any part of it in the file "COPYING".
##  If you do not have this file you can access the license 
##  through the WWW at http://www.kikonf.org/license/bsd/license.txt.
## 
##  Home: http://www.kikonf.org
##  Contact: kikonf@gmx.com



from actions.was.tools import *



class Tp(wasAction):
            
    def extract(self, scope_attrs=None, name=None, **keywords):
        scope_id, scope_attrs, scope=self.getScope(scope_attrs=scope_attrs, indent=self.getIndent())
        self.verbose(scope_attrs, name=name)
        indent=self.getIndent() + 3*' '

        found=False
        cmdvalues=[]
        verbose('ThreadPoolManager listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        tps=getStartByNameAsDict(split(AdminConfig.showAttribute(AdminConfig.list('ThreadPoolManager', scope_id), 'threadPools')))
        for tpname in tps.keys():
            if name!=None and tpname==name \
            or name==None:            
                verbose('ThreadPool:' + tpname + ' listed.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent())

                tp_node=self.newTop() # because in extract, this return a blank tp node.                
                threadpools=getShowAsDict(AdminConfig.show(tps[tpname]))
                tp_node.setAttrs(name=tpname, inact_timeout=threadpools['inactivityTimeout'], is_growable=threadpools['isGrowable'], max_size=threadpools['maximumSize'], min_size=threadpools['minimumSize'])
                
                mkNodeScope(tp_node, scope_attrs, isUnique=True)                # tag: scope

    def inject(self):
        self_funct='inject'
        tp_node = self.getTop()
        tp_attrs = tp_node.getAttrs()
        scope_id, scope_attrs, scope=self.getScope(parent_node=tp_node, indent=self.getIndent()) #-- Retreives scope
        self.verbose(scope_attrs, tp_attrs.name)
        indent=self.getIndent() + 3*' '

        found=False
        cmdvalues=[]
        verbose('ThreadPoolManager listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        tps=getStartByNameAsDict(split( AdminConfig.showAttribute(AdminConfig.list('ThreadPoolManager', scope_id), 'threadPools') ))
        for tpname in tps.keys():
            if not tpname==tp_attrs.name:continue
            else:
                found=True
                break
            
        if not found:raise xception.kikonfActionSystemException(self, self_funct, 'UNable to fing ThreadPool named:' + str(tp_attrs.name) + ' !')
        
        # - force the Orb to use the general ThreadPool Manager Orb.thread.pool (and not its one).
        if tpname=='ORB.thread.pool':
            verbose('ObjectRequestBroker listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
            orb=AdminConfig.list('ObjectRequestBroker', scope_id)
            verbose('ObjectRequestBroker updating.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
            AdminConfig.modify(orb, 'useServerThreadPool', 'true')

        cmdvalues.append(['inactivityTimeout', tp_attrs.inact_timeout])
        cmdvalues.append(['isGrowable', tp_attrs.is_growable])
        cmdvalues.append(['maximumSize', tp_attrs.max_size])
        cmdvalues.append(['minimumSize', tp_attrs.min_size])
        
        verbose('ThreadPool updating.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        AdminConfig.modify(tps[tpname], cmdvalues)
        verbose('ThreadPool:' + tp_attrs.name + ' updated.', level=self.getVerbose(), ifLevel=3, indent=indent)
        
    def verbose(self, scope_attrs, name=None):
        scope=str(scope_attrs).replace("'", '')[1:-1]
        
        if name!=None:verbose('ThreadPool at scope:' + scope + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent())
        else:verbose('ThreadPools at scope:' + scope + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent())
							
(Source: <KIKONF_INSTALLATION_DIR>/plugins/actions/was/tp/by/kikonf/tp.py)


  • Line 1 to 3 say something , say something , say something
  • Line 10 to 17 say something , say something , say something , say something , say something
  • Line 20 to 25 say something



Trademarks :
  • "IBM", "WebSphere", "WebSphere Aplication Server", "WAS" are registred trademarks of International Business Machines Corporation.
  • "Java" and "JVM" are a registred trademarks of Oracle and/or its affiliates.
  • Other names may be trademarks of their respective owners.

Copyright © 2011 - Patrick Placidoux, Hélène Malamoud