Github user jburwell commented on the pull request:
https://github.com/apache/cloudstack/pull/1331#issuecomment-214518411
@rafaelweingartner yes, as I have said, ``final statics`` are not evaluated
for GC. A single case is not a noticeable problem. However, if made all
loggers were made instance variables, given the number we have, it would become
a problem. You stated that your preference was to make loggers instance
variables, and that they being ``final static`` was purely cosmetic. My point
is that there are both performance and capability motivations to make them
``final static`` (i.e. the ability to log from static methods and accumulated
GC overhead).
Personally, I use Mockito (and its ilk) sparingly. Namely, I only use it
in circumstances where language constructs are unable to mock a mechanism.
First, I find it more difficult to understand the intentions of a test using
Mockito rather than pure Java as it layers another set of abstractions onto the
test. Second, Mockito approaches discourage reuse. We could use Mockito to
mock logging tests in this case. However, we have done nothing to make testing
of expected logging easier for future test cases.
It's most important to me that we do not start turning references to
constant values into instance variables due to potential GC churn. It's less a
memory size issue than it is about the length of GC operations and CPU
overhead. The Mockito vs. ``TestAppender`` approach is up to @syed and what he
feels most comfortable implementing.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---