[jboss-remoting-issues] [JBoss JIRA] Closed: (JBREM-1170) System.gc() should not call in ServerInvokerCallbackHandler

Ron Sigal (JIRA) jira-events at lists.jboss.org
Tue Jan 12 00:29:30 EST 2010


     [ https://jira.jboss.org/jira/browse/JBREM-1170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Sigal closed JBREM-1170.
----------------------------

    Resolution: Rejected


> 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

        


More information about the jboss-remoting-issues mailing list