[
https://jira.jboss.org/jira/browse/JBREM-1170?page=com.atlassian.jira.plu...
]
Ron Sigal commented on JBREM-1170:
----------------------------------
Hi Ryu Ken,
It's true that garbage collection might be time consuming, but it's done only if
ServerInvokerCallbackHandler is in danger of running out of memory. It's an attempt
to avoid doing disk i/o, which is also time consuming. Unless you have a specific problem
in mind, I'm going to close this issue.
Thanks,
Ron
System.gc() should not call in ServerInvokerCallbackHandler
-----------------------------------------------------------
Key: JBREM-1170
URL:
https://jira.jboss.org/jira/browse/JBREM-1170
Project: JBoss Remoting
Issue Type: Quality Risk
Security Level: Public(Everyone can see)
Components: callbacks
Affects Versions: 2.2.2.SP11
Reporter: ryu ken
It seems System.gc() will be call when Memory Low has been detected.
In fact, calling System.gc() may cause performance problems.
handleCallback():
// need to check if should persist callback instead of keeping in memory
if(shouldPersist())
{
try
{
persistCallback(callback);
synchronized (callbacks)
{
callbacks.notify();
}
callback = null;
// try to help out with the amount of memory usuage
new Thread()
{
public void run()
{
System.gc();
}
}.start();
}
catch(IOException e)
{
log.error("Unable to persist callback", e);
throw new HandleCallbackException("Unable to persist callback and
will not " +
"be able to deliver.", e);
}
}
getPersistedCallbacks():
if(isMemLow())
{
new Thread()
{
public void run()
{
System.gc();
}
}.start();
break;
}
isMemLow():
Runtime runtime = Runtime.getRuntime();
long max = runtime.maxMemory();
long total = runtime.totalMemory();
long free = runtime.freeMemory();
float percentage = 100 * free / total;
if(max == total && memPercentCeiling >= percentage)
{
return true;
}
else
{
return false;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira