Configuring java thread pool in websphere

ibm websphere
Using below function we can configure the java thread pool properties in websphere
#--Configuring thread pool properties for Web container 
#-- params req -- nodeName serverName hostname
proc webcontainer_threadpool {} {
	puts "************************************************************************"
	puts "----  		Configuring Threadpool properties for Web container  ----"
	puts "************************************************************************"

	set aServer [$AdminConfig getid /Node:$nodeName/Server:$serverName/]
	# get the WebContainer config object name for the above server
	set aWC [$AdminConfig list WebContainer $aServer]

	# setting up virtualHost and servletCaching attributes
	set virtualHostAttr [list defaultVirtualHostName $hostname]
	set servletCachingAttr [list enableServletCaching true]
	# modifying virtualHost and servletCaching attributes
	puts "Modifying general properties"
	set attrs [list $virtualHostAttr $servletCachingAttr]
	$AdminConfig modify $aWC $attrs
	# setting up ThreadPool attributes
	# inactivity time out is in number of milliseconds
	set inactivityTimeoutAttr [list inactivityTimeout 1000]
	set isGrowableAttr [list isGrowable true]
	set maxSzAttr [list maximumSize 20]
	set minSzAttr [list minimumSize 5]
	set threadPoolAttrs [list $inactivityTimeoutAttr $isGrowableAttr $maxSzAttr $minSzAttr]
	# get ThreadPool config object name for the WebContainer
	set threadPool [$AdminConfig showAttribute $aWC threadPool]
	# check if there is existing thread pool
	if {[llength $threadPool] != 0} {
	# modifying ThreadPool attribute
	puts "Modifying ThreadPool properties"
	$AdminConfig modify $threadPool $threadPoolAttrs
	puts [$AdminConfig showall $threadPool]
	} else {
	# create a thread pool
	puts "Creating a new ThreadPool"
	set threadPool [$AdminConfig create ThreadPool $aWC $threadPoolAttrs]
	puts [$AdminConfig showall $threadPool]
	puts "saving configuration."
	$AdminConfig save

In case of any ┬ęCopyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply