From: <ma...@rh...> - 2009-06-18 20:24:05
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [4128] be able to configure the vm health check thread to NOT perform GC if you dont want to</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>4128</dd> <dt>Author</dt> <dd>mazz</dd> <dt>Date</dt> <dd>2009-06-18 09:48:53 -0500 (Thu, 18 Jun 2009)</dd> </dl> <h3>Log Message</h3> <pre>be able to configure the vm health check thread to NOT perform GC if you dont want to</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulesenterpriseagentsrcmainjavaorgrhqenterpriseagentVMHealthCheckThreadjava">rhq/trunk/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/VMHealthCheckThread.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulesenterpriseagentsrcmainjavaorgrhqenterpriseagentVMHealthCheckThreadjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/VMHealthCheckThread.java (4127 => 4128)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/VMHealthCheckThread.java 2009-06-18 14:23:57 UTC (rev 4127) +++ rhq/trunk/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/VMHealthCheckThread.java 2009-06-18 14:48:53 UTC (rev 4128) </span><span class="lines">@@ -79,6 +79,14 @@ </span><span class="cx"> private final float nonheapThreshold; /** </span><span class="add">+ * If <code>true</code>, the thread will explicitly ask for garbage collection to occur when + * memory is critical. If <code>false</code>, the thread will merely report when memory is critical, + * but it will not attempt to correct the situation itself - it will assume the garabage collector + * will trigger at the appropriate time. + */ + private final boolean performGC; + + /** </span><span class="cx"> * These are names used to identify MemoryPoolMXBeans that are to be monitored. */ private final List<String> memoryPoolsToMonitor; </span><span class="lines">@@ -108,6 +116,9 @@ </span><span class="cx"> this.memoryPoolsToMonitor.add(memoryPoolName.toLowerCase()); // lowercase so our checks are case-insensitive } </span><span class="add">+ String gcProp = System.getProperty("rhq.agent.vm-health-check.perform-gc", "true"); + this.performGC = Boolean.parseBoolean(gcProp); + </span><span class="cx"> return; } </span><span class="lines">@@ -270,8 +281,10 @@ </span><span class="cx"> if (heapCritical || nonheapCritical) { // uh-oh, we are low on memory, before we say we are truly critical, try to GC try { </span><span class="rem">- LOG.warn(AgentI18NResourceKeys.VM_HEALTH_CHECK_THREAD_GC); - bean.gc(); </span><span class="add">+ if (this.performGC) { + LOG.warn(AgentI18NResourceKeys.VM_HEALTH_CHECK_THREAD_GC); + bean.gc(); + } </span><span class="cx"> // let see what our memory usage is now heapCritical = isCriticallyLow(bean.getHeapMemoryUsage(), this.heapThreshold, "VM heap"); </span><span class="lines">@@ -311,8 +324,10 @@ </span><span class="cx"> if (critical) { // uh-oh, we are low on memory, before we say we are truly critical, try to GC try { </span><span class="rem">- LOG.warn(AgentI18NResourceKeys.VM_HEALTH_CHECK_THREAD_GC); - memoryMxBean.gc(); </span><span class="add">+ if (this.performGC) { + LOG.warn(AgentI18NResourceKeys.VM_HEALTH_CHECK_THREAD_GC); + memoryMxBean.gc(); + } </span><span class="cx"> // let see what our memory usage is now critical = isCriticallyLow(bean.getUsage(), this.heapThreshold, bean.getName()); </span> </pre> </div> </div> </body> </html> |