Yvonne Ironberg created STORM-1000:
--------------------------------------

             Summary: Use static member classes when permitted
                 Key: STORM-1000
                 URL: https://issues.apache.org/jira/browse/STORM-1000
             Project: Apache Storm
          Issue Type: Improvement
            Reporter: Yvonne Ironberg
            Assignee: Yvonne Ironberg
            Priority: Minor


In Java, the difference between “static member class” and “nonstatic member 
class” is simply a reference to enclosing instance. “Static” here means 
“independent of the enclosing instance”. Or “an enclosed instance can survive 
without an enclosing instance”.
* For an instance of a nonstatic member class, there is a reference from the 
enclosed instance to the enclosing instance. When the enclosing instance 
doesn’t exist, you cannot instantiate the nonstatic member class.
* For an instance of a static member class, there isn’t such a reference from 
the enclosed instance to the enclosing instance. So this helps the enclosing 
instance be garbage-collected.

Favoring static member classes when permitted improves performance because time 
and space for extra references are saved.

This optimization was done before for Storm (e.g., as part of 
(https://issues.apache.org/jira/browse/STORM-797)[STORM-797], see 
(https://patch-diff.githubusercontent.com/raw/apache/storm/pull/537.patch)[its 
patch]).

This issue tries to improve all such places in the current codebase. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to