• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

memory setting

 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where in JBoss jmx console can I check how much RAM is allocated for JBoss on server?

thanks,
Alex
 
Jeff Shelley
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what you're looking for is jboss.system,type=ServerInfo.
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it. But I have three fields:

FreeMemory 22867000
MaxMemory -1
TotalMemory 45850624

First and last I understand, but what is MaxMemory? And, how do I change TotalMemory?
 
Jeff Shelley
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is where the values come from:

Runtime.getRuntime().totalMemory();
Runtime.getRuntime().freeMemory();


Max memory is a bit trickier
public Long getMaxMemory()
{
if (Java.isCompatible(Java.VERSION_1_4)) {
// Uncomment when JDK 1.4 is the base JVM
// return new Long(Runtime.getRuntime().maxMemory());

// until then use reflection to do the job
try {
Runtime rt = Runtime.getRuntime();
Method m = rt.getClass().getMethod("maxMemory", new Class[0]);
return (Long)m.invoke(rt, new Object[0]);
}
catch (Exception e) {
log.error("Operation failed", e);
}
}

return new Long(-1);
}


Here's the 1.4.2 Runtime Class.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html

I'm not quite sure how to change them, though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic