Github user jburwell commented on the pull request:

    https://github.com/apache/cloudstack/pull/1331#issuecomment-215620806
  
    @rafaelweingartner I apologize -- I did not understand that you were 
focused on ``final`` not ``final static``.  You are correct, ``final`` has 
nothing to do with garbage collection -- it is about thread safety.  There are 
very few (and rare) circumstances where a ``static`` reference should be 
mutable because it accessible across thread boundarys.  When they need to be 
mutable, special care must be taken to ensure exclusive access (e.g. 
``synchronized`` blocks, ``ReentrantLock``, ``AtomicReference``, etc).  
Therefore, I always put the two together.  In this case, the logger is a 
constant value and should be declared ``final``.  Sacrificing thread-safety for 
unit test is not an appropriate trade-off in my opinion.
    
    Stepping back a bit, why are we investing so much time and effort to test a 
``DEBUG`` log message?  ``DEBUG`` level messages should only be for developers 
during development of the system.  Not only is a low value item to test, it 
makes the test case brittle as there should never be any guarantees about log 
messages at ```DEBUG`` and ``TRACE`` log levels.  In my opinion, @syed should 
remove this part of the test entirely.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to