###   
### dump_threads.jacl   
###   
### Use the AdminControl object to dump the Java threads of a running server. 
###   
   


### 
### 
### 

proc dump_threads {sname} {   
   
   
###   
### set up globals   
###   
   
global AdminConfig   
global AdminControl   
global AdminApp   

puts "Dumping threads for $sname"

set jvm [$AdminControl completeObjectName type=JVM,process=$sname,*] 

puts "JVM: $jvm"

$AdminControl invoke $jvm dumpThreads 


puts "Threads dumped.  "
#puts "File can be found in /opt/WebSphere/AppServer/logs/$sname  "
   

}   



   
##   
## Main   
##   
   
   
if { !($argc == 1) } {   
   puts ""   
   puts "Usage:  "   
   puts " "   
   puts "wsadmin.sh -username system -password password -f dump_threads.jacl servername" 
   puts ""   
   puts "For example:  "   
   puts " "   
   puts "wsadmin.sh -username was -password acme@ -f  dump_threads.jacl wstest4" 
} else {    
   set xserver      [lindex $argv 0]     

   dump_threads $xserver
  
}