2

Is there a way to check the ThreadStackSize programmatically?

I have the following code in Jboss 7's jboss.conf file.

 # Java Additional Parameters
wrapper.java.additional.1=-XX:MaxPermSize=512m
wrapper.java.additional.2=-Dorg.jboss.resolver.warning=true
wrapper.java.additional.3=-Dsun.rmi.dgc.client.gcInterval=3600000
wrapper.java.additional.4=-Dsun.rmi.dgc.server.gcInterval=3600000
wrapper.java.additional.5=-Djboss.modules.system.pkgs=org.jboss.byteman
wrapper.java.additional.6=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=false
wrapper.java.additional.7=-Dlogging.configuration=file:%JBOSS_HOME%/standalone/configuration/logging.properties
wrapper.java.additional.8=-Djava.util.logging.manager=org.jboss.logmanager.LogManager
wrapper.java.additional.9=-Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl

**wrapper.java.additional.10=-XX:ThreadStackSize=256k**

Is there a way to confirm if the ThreadStackSize has been set to 256k programmatically?

Cœur
  • 34,719
  • 24
  • 185
  • 251
jamshed Katta
  • 73
  • 1
  • 9

2 Answers2

0

Have a read here: Update a java thread's stack size at runtime

You could probably try to grab the stackSize variable using reflection and see if that gives you anything useful. Be wary:

/*
 * The requested stack size for this thread, or 0 if the creator did
 * not specify a stack size.  It is up to the VM to do whatever it
 * likes with this number; some VMs will ignore it.
 */
0

The problem is that the -XX args are implementation specific, so the core Java classes can't expose that information directly as a simple getMaxStackSize().

There are a lot of useful metrics in the java.lang.management package, such as the MemoryPoolMXBean. I haven't tried looking for stack size in particular, but if you dig around you might find it.

Tim Gage
  • 1,371
  • 9
  • 19