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







Jvm

print

Action : was.jvm   (Category : was, Name : jvm, By : kikonf)
Complete Name : was.jvm.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 jvm plugin : Tune one JVM characteristics

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

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 Jvm(wasAction):
    DFT_TEMP_ARGS=(
        '-Dworkspace.user.root', 
        '-Dwas.repository.temp',
        '-Dcom.ibm.websphere.servlet.temp.dir',
        '-DumpDir',
        '-Dtemp.dir',
        '-Djava.io.temp',
        '-Djava.io.tmpdir',
        '-Djava.util.prefs.userRoot',
        '-Djava.util.prefs.systemRoot'
        )

    def extract(self, indent=None, scope_attrs=None, **keywords):
        self_funct='extract'        
        self.verbose(scope_attrs)
        scope_id, scope_attrs, scope=self.getScope(scope_attrs=scope_attrs, indent=self.getIndent())
        
        indent=self.getIndent() + 3*' '
        
        jvm_node=self.newTop() #-- because in extract mode, each call returns a new blank top node.
        mkNodeScope(jvm_node, scope_attrs, isUnique=True) #-- creates a scope node.

        verbose('JavaVirtualMachine listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())            
        jvm=AdminConfig.list('JavaVirtualMachine', scope_id)        
        
        jvms=getShowAsDict(AdminConfig.show(jvm))
        verbose('JavaVirtualMachine listed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())

        attrs={}                                                                # Tag: jvm
        attrs['xms']=int(jvms['initialHeapSize'])
        attrs['xmx']=int(jvms['maximumHeapSize'])
        attrs['run_hprof']=jvms['runHProf']

        if jvms.has_key('hprofArguments'):run_hprofs=jvms['hprofArguments'][1:-1].split()
        else:run_hprofs=[]
        
        attrs['disable_jit']=jvms['disableJIT']
        
        jvmargs=jvms['genericJvmArguments'][1:-1]
        jvmargs=jvmargs.split()
        
        #-- Retreives temp_dir Attribute
        temp_dir=None
        other_jvmargs=[]
        
        for entry in jvmargs:
            if entry=='' or entry.isspace():continue            
            spl=entry.split('=')
            key=spl[0].strip()
            value=None
            if len(spl)>1:value=spl[1].strip()
            
            if key in Jvm.DFT_TEMP_ARGS:
                if temp_dir==None:temp_dir=value
                elif temp_dir!=value:temp_dir=False        
            else:
                other_jvmargs.append(entry)
            
        if temp_dir in (None, False):attrs['temp_dir']=None
        else:attrs['temp_dir']=temp_dir

        attrs['ha']=self.extHA(indent=indent)        
        attrs['plugin_max_con']=self.extPluginMaxCon(indent=indent)        
        attrs['user'], attrs['group']=self.extUserGroup(indent=indent)
        
        jvm_node.setAttrs(**attrs)                                              #-- Sets Attributes for top node.
        
        cl=gc=jni='false'                                                       # Tag: verbose
        if jvms['verboseModeClass']=='true':cl='true'
        if jvms['verboseModeGarbageCollection']=='true':gc='true'
        if jvms['verboseModeJNI']=='true':jni='true'
        
        jvm_node.newNode('verbose', cl=cl, gc=gc, jni=jni)                      #-- creates the node verbose.
        
        classpath=jvms['classpath']                                             # Tag: classpath
        classpath=classpath.split()
        if len(classpath)!=0 and classpath[0]!='[]':
            classpath_node=jvm_node.newNode('classpath')
            for cp in classpath:classpath_node.addText(cp)
            
        boot_classpath=jvms['bootClasspath']                                    # Tag: boot_classpath
        boot_classpath=boot_classpath.split()
        if len(boot_classpath)!=0 and boot_classpath[0]!='[]':
            boot_classpath_node=jvm_node.newNode('boot_classpath')
            for cp in boot_classpath:boot_classpath_node.addText(cp)

        enable_debug=jvms['debugMode']                                          # Tag: debug_args
        debug_args=jvms['debugArgs']
        if len(debug_args)>=2:debug_args=debug_args[1:-1]
        debug_args=debug_args.split()
        if len(debug_args)!=0:            
            debug_args_node=jvm_node.newNode('debug_args', enable=enable_debug)
            for cp in debug_args:debug_args_node.addText(cp)
        elif enable_debug=='true':jvm_node.newNode('debug_args', enable=enable_debug)
    
        if len(run_hprofs)!=0:                                                  # Tag: run_hprof
            hprof_args_node=jvm_node.newNode('hprof_args')
            for run_hprof in run_hprofs:hprof_args_node.addText(run_hprof)
            
        sps=split(jvms['systemProperties'])                                     # Tag: system_props
        if len(sps)!=0:
            system_props_node=jvm_node.newNode('system_props')
            for sp in sps:
                attrs={}
                attrs['name']=AdminConfig.showAttribute(sp, 'name')
                attrs['value']=AdminConfig.showAttribute(sp, 'value')
                system_props_node.newNode('property', **attrs)

        self.extTimouts(jvm_node, indent=indent)                                # Tag: system_props

        other_jvmargs=self.extLibs(other_jvmargs, jvm_node, indent=indent)      # Tag: extlibs
        
        other_jvmargs=self.extGc(other_jvmargs, jvm_node, indent=indent)        # Tag: gc

        other_jvmargs=self.extSharedClasses(other_jvmargs, jvm_node, indent=indent) # Tag: shared_classes
            
        if len(other_jvmargs)!=0:                                               # Tag: generic_jvm_args
            generic_jvm_args_node=jvm_node.newNode('generic_jvm_args')
            for jvmarg in other_jvmargs:
                generic_jvm_args_node.addText(jvmarg)

    def inject(self):
        self_funct='inject'
        jvm_node = self.getTop()                                                #-- Grabs top node
        jvm_attrs = jvm_node.getAttrs()
        scope_id, scope_attrs, scope=self.getScope(parent_node=jvm_node, indent=self.getIndent()) #-- Retreives scope
        self.verbose(scope_attrs)
        indent=self.getIndent() + 3*' '

        cmdvalues=[]           
        cmdvalues.append(['initialHeapSize', jvm_attrs.xms])                    # Tag jvm/Attribute: xms
        cmdvalues.append(['maximumHeapSize', jvm_attrs.xmx])                    # Tag jvm/Attribute: xmx
        cmdvalues.append(['runHProf', jvm_attrs.run_hprof])                     # Tag jvm/Attribute: run_hprof 
        cmdvalues.append(['disableJIT', jvm_attrs.disable_jit])                 # Tag jvm/Attribute: disable_jit
        
        if jvm_node.hasNode('verbose'):                                         # Tag jvm/Attribute: verbose
            verbose_attrs=jvm_node.getNode('verbose')[0].getAttrs()
            cmdvalues.append(['verboseModeClass', verbose_attrs.cl])        
            cmdvalues.append(['verboseModeGarbageCollection', verbose_attrs.gc])        
            cmdvalues.append(['verboseModeJNI', verbose_attrs.jni]) 
            
        if jvm_node.hasNode('classpath'):                                       # Tag: classpath
            cps=jvm_node.getNode('classpath')[0].getText()
            if len(cps)==0:classpath=''
            elif len(cps)==1:classpath=cps[0]
            else:classpath=';'.join(cps)        
            cmdvalues.append(['classpath', classpath])      

        if jvm_node.hasNode('boot_classpath'):                                  # Tag: boot_classpath
            bcps=jvm_node.getNode('boot_classpath')[0].getText()
            if len(bcps)==0:
                boot_classpath=''
            elif len(bcps)==1:
                boot_classpath=bcps[0]
            else:
                boot_classpath=';'.join(bcps)
            cmdvalues.append(['bootClasspath', boot_classpath]) 

        if jvm_node.hasNode('debug_args'):                                      # Tag: debug_args
            debug_args_node=jvm_node.getNode('debug_args')[0]
            cmdvalues.append(['debugMode', debug_args_node.getAttr('enable')])
            debug_args=debug_args_node.getText()
            if len(debug_args)==0:debug_args=''
            elif len(debug_args)==1:debug_args=debug_args[0]
            else:debug_args=' '.join(debug_args)
            cmdvalues.append(['debugArgs', debug_args])            

        hprof_args=''                                                           # Tag: hprof_args
        if jvm_node.hasNode('hprof_args'):
            hprof_args=jvm_node.getNode('hprof_args')[0].getText()
            if len(hprof_args)==0:hprof_args=''
            elif len(hprof_args)==1:hprof_args=hprof_args[0]
            else:hprof_args=' '.join(hprof_args)        
            cmdvalues.append(['hprofArguments', hprof_args]) 
        
        if jvm_node.hasNode('system_props'):                                    # Tag: system_props
            system_props_node=jvm_node.getNode('system_props')[0]
            if system_props_node.hasNode('property'):                
                cmd_properties=[]
                properties=system_props_node.getNode('property')                
                for property in properties:
                    cmd_property=[]
                    cmd_properties.append(cmd_property)
                    property_attrs=property.getAttrs()
                    cmd_property.append(['name', property_attrs.name])
                    cmd_property.append(['value', property_attrs.value])

                cmdvalues.append(['systemProperties', cmd_properties ])

        cmdvalues.append(self.injJvmArgs(jvm_node, indent=indent))              #-- Treats and Appends Jvm Args

        # Creates
        verbose('JavaVirtualMachine listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        oid=AdminConfig.list('JavaVirtualMachine', scope_id)                    #-- Retrieves jvm_id
        verbose('JavaVirtualMachine listed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
        verbose('JavaVirtualMachine removing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        AdminConfig.remove(oid)                                                 #-- Deletes jvm_id
        verbose('JavaVirtualMachine removed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
        verbose('JavaProcessDef listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        pdef=AdminConfig.list('JavaProcessDef', scope_id)                       #-- Recreates jvm
        
        verbose('JavaVirtualMachine creating.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        AdminConfig.create('JavaVirtualMachine', pdef, cmdvalues)
        verbose('JavaVirtualMachine created.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
        #-- Trivial Server configurations
        self.injHA(jvm_attrs, indent=indent)
        self.injPluginMaxCon(jvm_attrs, indent=indent)
        self.injUserGroup(jvm_attrs, indent=indent)
        self.injTimouts(jvm_node, indent=indent)



                                    # -------------------------------  Sub methods -------------------------------#
    
    
    
    def injJvmArgs(self, jvm_node, indent=None):
        self_funct='injJvmArgs'

        cmdvalues=[]
        jvm_attrs=jvm_node.getAttrs()
        
        generic_jvm_args=''                                                     # Tag: generic_jvm_args
        if jvm_node.hasNode('generic_jvm_args'):
            generic_jvm_args=jvm_node.getNode('generic_jvm_args')[0].getText()
            if len(generic_jvm_args)>=1:
                cmdvalues.extend(generic_jvm_args)
                
                                                                                # Tag: generic_jvm_args

        if jvm_node.hasNode('extlibs'):                                          # Tag: extlib
            extlibs=jvm_node.getNode('extlibs')[0].getText()
            for extlib in extlibs:
                cmdvalues.append('-DextDir ' + extlib)

        if jvm_node.hasNode('gc'):                                              # Tag: gc
            gc_node=jvm_node.getNode('gc')[0]
            
            if gc_node.hasNode('explicitgc'):                                   # Attribute: gc/explicitgc
                explicitgc_node=gc_node.getNode('explicitgc')[0]
                explicitgc_attrs=explicitgc_node.getAttrs()
                if explicitgc_attrs.disable=='true':
                    cmdvalues.append('-Xdisableexplicitgc')  

            if gc_node.hasNode('policy'):                                       # Attribute: gc/policy
                pol_node=gc_node.getNode('policy')[0]
                pol_attrs=pol_node.getAttrs()
                ptype=pol_attrs.type
                
                if ptype!='gencon':
                    cmdvalues.append('-Xgcpolicy:' + ptype)
                else:
                    if not pol_node.hasNode('gencon'):raise xception.kikonfActionSystemException(self, self_funct, 'The node gencon is required for the Tag: gc/policy !')
                    gencon_node=pol_node.getNode('gencon')[0]
                    gencon_attrs=gencon_node.getAttrs()
                    
                    xmns=xmnx=xmos=xmox=''
                    if hasattr(gencon_attrs, 'xmns')   and gencon_attrs.xmns!=None:xmns=' -Xmns' + str(gencon_attrs.xmns) + 'm'
                    if hasattr(gencon_attrs, 'xmnx') and gencon_attrs.xmnx!=None:xmnx=' -Xmnx' + str(gencon_attrs.xmnx) + 'm'
                    if hasattr(gencon_attrs, 'xmos') and gencon_attrs.xmos!=None:xmos=' -Xmos' + str(gencon_attrs.xmos) + 'm'
                    if hasattr(gencon_attrs, 'xmox') and gencon_attrs.xmox!=None:xmox=' -Xmox' + str(gencon_attrs.xmox) + 'm'
                    
                    cmdvalues.append('-Xgcpolicy:' + ptype + ' ' + xmns + xmnx + xmos + xmox)
                    
            if gc_node.hasNode('threads'):                                      # Tag: gc/threads
                threads_node=gc_node.getNode('threads')[0]
                threads_attrs=threads_node.getAttrs()
                cmdvalues.append('-Xgcthreads:' + str(threads_attrs.number))

        if jvm_node.hasNode('shared_classes'):                                  # Tag: shared_classes
            shared_classes_node=jvm_node.getNode('shared_classes')[0]
            shared_classes_attrs=shared_classes_node.getAttrs()

            if shared_classes_attrs.enable=='true':
                fatal=''
                if shared_classes_attrs.required=='false':fatal=',nonFatal'
                cmdvalues.append('-Xshareclasses:name=' + shared_classes_attrs.name + fatal + ',controlDir=' + shared_classes_attrs.control_dir + ' -Xscmx' + str(shared_classes_attrs.size) + 'm')
      
        if hasattr(jvm_attrs, 'temp_dir') and jvm_attrs.temp_dir!=None:          # Attribute: temp dir
            cmdvalues.extend([arg + '=' + jvm_attrs.temp_dir for arg in Jvm.DFT_TEMP_ARGS])

        return ['genericJvmArguments', ' '.join(cmdvalues)]

    def injHA(self, jvm_attrs, indent=None):  
        scope_id, scope_attrs, scope=self.getScope()
        cmdvalues=[]
        
        cmdvalues.append(['enable', jvm_attrs.ha])                               # Attribute: ha
        cmdvalues.append(['activateEnabled', jvm_attrs.ha])
        
        verbose('HAManagerService listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        ha=AdminConfig.list('HAManagerService', scope_id)
        verbose('HAManagerService modfying.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        AdminConfig.modify(ha, cmdvalues)
        verbose('HAManagerService modified.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
    def injPluginMaxCon(self, jvm_attrs, indent=None):   
        if not hasattr(jvm_attrs, 'plugin_max_con') or jvm_attrs.plugin_max_con==None:return
        scope_id, scope_attrs, scope=self.getScope()

        verbose('WebserverPluginSettings listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())        
        wps=AdminConfig.list('WebserverPluginSettings', scope_id)               # Attribute: plugin_max_con
        verbose('WebserverPluginSettings modifying.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        AdminConfig.modify(wps,'MaxConnections',jvm_attrs.plugin_max_con)
        verbose('WebserverPluginSettings modified.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
    def injUserGroup(self, jvm_attrs, indent=None):                             # Attribute: user/group
        if hasattr(jvm_attrs, 'user'):user=jvm_attrs.user                       
        if hasattr(jvm_attrs, 'group'):group=jvm_attrs.group
        if user==group==None:return
        scope_id, scope_attrs, scope=self.getScope()
        cmdvalues=[]
        
        if user!=None:cmdvalues.append(['runAsUser', user])
        if group!=None:cmdvalues.append(['runAsGroup', group])
        cmdvalues.append(['runInProcessGroup', '0'])
        cmdvalues.append(['processPriority', '20' ])
        cmdvalues.append(['umask', '002' ])
        
        verbose('ProcessDef listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        pdef = AdminConfig.list('ProcessDef', scope_id)
        verbose('ProcessDef modifying.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        AdminConfig.modify(pdef, 'execution', cmdvalues)
        verbose('ProcessDef modified.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
    def injTimouts(self, jvm_node, indent=None):                                             # Tag: timout
        if not jvm_node.hasNode('timouts'):return
        scope_id, scope_attrs, scope=self.getScope()
        
        #-- Transaction Service
        timouts_attrs=jvm_node.getNode('timouts')[0].getAttrs()

        verbose('TransactionService listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        ts=AdminConfig.list('TransactionService', scope_id)
        verbose('TransactionService modifying.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        AdminConfig.modify(ts, 'totalTranLifetimeTimeout', timouts_attrs.tran_timout)
        verbose('TransactionService modified.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
        #-- Orb req
        cmdvalues=[]
        cmdvalues.append(['requestTimeout', timouts_attrs.orb_req_timout])
        cmdvalues.append(['locateRequestTimeout', timouts_attrs.orb_locale_req_timout])
        
        verbose('ObjectRequestBroker listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        oid=AdminConfig.list('ObjectRequestBroker', scope_id)
        verbose('ObjectRequestBroker modifying.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        AdminConfig.modify(oid, cmdvalues)
        verbose('ObjectRequestBroker modified.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())        
        
    def extHA(self, indent=None):
        scope_id, scope_attrs, scope=self.getScope()
        
        verbose('HAManagerService listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        ha=AdminConfig.list('HAManagerService', scope_id)
        verbose('HAManagerService listed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())        
        if AdminConfig.showAttribute(ha, 'enable')=='true' or AdminConfig.showAttribute(ha, 'activateEnabled')=='true':return 'true'
        else:return 'false'
    
    def extPluginMaxCon(self, indent=None):   
        scope_id, scope_attrs, scope=self.getScope()
        
        verbose('WebserverPluginSettings listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        wps=AdminConfig.list('WebserverPluginSettings', scope_id)
        verbose('WebserverPluginSettings listed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())        
        return AdminConfig.showAttribute(wps, 'MaxConnections')

    def extUserGroup(self, indent=None):
        scope_id, scope_attrs, scope=self.getScope()
        
        verbose('ProcessDef listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        pdef = AdminConfig.list('ProcessDef', scope_id)
        verbose('ProcessDef listed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())        
        oid=AdminConfig.showAttribute(pdef, 'execution')
        
        user=AdminConfig.showAttribute(oid, 'runAsUser')
        group=AdminConfig.showAttribute(oid, 'runAsGroup')
        
        return user, group
    
    def extTimouts(self, jvm_node, indent=None):                                # Tag: timouts
        scope_id, scope_attrs, scope=self.getScope()
        attrs={}
        
        verbose('TransactionService listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        oid=AdminConfig.list('TransactionService', scope_id)
        verbose('TransactionService listed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())        
        attrs['tran_timout']=AdminConfig.showAttribute(oid, 'totalTranLifetimeTimeout')

        verbose('ObjectRequestBroker listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        oid=AdminConfig.list('ObjectRequestBroker', scope_id)
        verbose('ObjectRequestBroker listed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())        
        attrs['orb_req_timout']=AdminConfig.showAttribute(oid, 'requestTimeout')
        attrs['orb_locale_req_timout']=AdminConfig.showAttribute(oid, 'locateRequestTimeout')
        
        jvm_node.newNode('timouts', **attrs)
            
    def extLibs(self, other_jvmargs, jvm_node, indent=None):                    # Tag: extlibs
        wrks=other_jvmargs
        other_jvmargs=[]
        extlibs=[]
        dosh=False
        i=0
        
        while i<len(wrks):
            entry=wrks[i].strip()

            if entry.startswith('-DextDir'):
                dosh=True
                if entry=='-DextDir':
                    i+=1
                    extlibs.append(wrks[i].strip())                    
                else:extlibs.append(entry.split('-DextDir')[1])
            else:other_jvmargs.append(entry)
            i+=1    

        wrks=None
        if dosh:
            extlibs_node=jvm_node.newNode('extlibs')
            for extlib in extlibs:extlibs_node.addText(extlib)
            
        return other_jvmargs

    def extGc(self, other_jvmargs, jvm_node, indent=None):                      # Tag: gc
        dogc=dogc_pol=dogc_thread=False
        dexplicitgc='false'
        xmns=xmnx=xmos=xmox=None
        wrks=other_jvmargs
        other_jvmargs=[]
        mems={}
        other_jvmargs=[]
        i=0

        while i<len(wrks):
            entry=wrks[i].strip()
            
            # ex: -Xgcpolicy:gencon  -xmns128m -xmnx256m -xmos128m -xmox768m Xgcthreads:45            
            
            if entry=='-Xdisableexplicitgc':
                dogc=True
                dexplicitgc='true'
                
            elif entry.startswith('-Xmns')  or entry.startswith('-Xmnx') or entry.startswith('-Xmos') or entry.startswith('-Xmox'):
                i=self.__extGcGetMem(wrks, i, mems)
                
            elif entry.startswith('-Xgcpolicy:'):
                dogc=True
                dogc_pol=True
                ptype=entry.split(':')[1]
            elif entry.startswith('-Xgcthreads:'):
                dogc=True
                dogc_thread=True
                nthread=entry.split(':')[1]
            else:
                other_jvmargs.append(entry)                
            i+=1
            
        wrks=None
  
        if dogc:
            gc_node=jvm_node.newNode('gc')
            gc_node.newNode('explicitgc', disable=dexplicitgc)
            
            if dogc_pol:
                policy_node=gc_node.newNode('policy',type=ptype)
                if len(mems)!=0:policy_node.newNode('gencon', **mems)

            if dogc_thread:gc_node.newNode('threads', number=nthread)
            
        return other_jvmargs
            
    def __extGcGetMem(self, wrks, i, mems):
        entry=wrks[i]
    
        if entry.startswith('-Xmns'):key='Xmns'
        elif entry.startswith('-Xmnx'):key='Xmnx'
        elif entry.startswith('-Xmos'):key='Xmos'
        elif entry.startswith('-Xmox'):key='Xmox'
    
        if entry=='-' + key:
            i+=1
            value=int(wrks[i].strip())            
        else:
            value=str(entry.split('-' + key)[1])
            
        if value!=None:
            if value[-1]=='m':value=value[:-1]
            try:
                value=int(value)
            except:raise xception.kikonfActionSystemException(self, self_funct, 'Unable to retreive a correct int value from Jvm Argument:' + key)
            
        mems[key.lower()]=value
            
        return i
            
    def extSharedClasses(self, other_jvmargs, jvm_node, indent=None):           # Tag: shared_classes
        wrks=other_jvmargs
        other_jvmargs=[]
        name=None
        required='true'
        control_dir=None
        size=None
        dosc=False
        i=0

        while i<len(wrks):
            entry=wrks[i].strip()

            if entry.startswith('-Xshareclasses'):
                dosc=True
                
                #-- name
                if not entry.find(':name='):dosc=False
                name=entry.split(':name=')[1]
                name=name.split(',')[0]
                #-- required
                if entry.find(',nonFatal'):required='false'
                #-- control_dir
                if not entry.find(',controlDir='):dosc=False
                control_dir=entry.split(',controlDir=')[1]
                control_dir=control_dir.split(',')[0]
                
            elif entry.startswith('-Xscmx'):
                if entry=='-Xscmx':
                    i+=1
                    size=wrks[i].strip()                    
                else:
                    size=entry.split('-Xscmx')[1]
                if size!=None and size[-1]=='m':size=size[:-1]
                else:size=''
            else:other_jvmargs.append(entry)
            i+=1    

        wrks=None
        
        if dosc:jvm_node.newNode('shared_classes', name=name, enable='true', required=required, control_dir=control_dir, size=size)
        
        return other_jvmargs
        
    def verbose(self, scope_attrs):
        scope=str(scope_attrs).replace("'", '')[1:-1]
        
        verbose('JavaVirtualMachine at scope:' + scope + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent())
							
(Source: <KIKONF_INSTALLATION_DIR>/plugins/actions/was/jvm/by/kikonf/jvm.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