Darrel Schneider created GEODE-6761:
---------------------------------------
Summary: LocalRegion.initializationThread creates unneeded garbage
Key: GEODE-6761
URL: https://issues.apache.org/jira/browse/GEODE-6761
Project: Geode
Issue Type: Improvement
Components: core
Reporter: Darrel Schneider
The LocalRegion.initializationThread ThreadLocal is currently used in a way
that can create unneeded garbage. It is common for operations (like put) to set
this ThreadLocal to BEFORE_INITIAL_IMAGE and then in a finally block to restore
the ThreadLocal to its previous value. In most cases the previous value will be
the default of AFTER_INITIAL_IMAGE. What the current code does to the
ThreadLocal when setting it back to AFTER_INITIAL_IMAGE is it removes the
ThreadLocal instead of setting it to the Integer AFTER_INITIAL_IMAGE. What this
causes under the covers is an entry in a map holding ThreadLocal instances to
be removed (making it garbage). Then when we set on the next op to
BEFORE_INITIAL_IMAGE we need to recreate an entry in the map the hold that
value.
An easy fix is to just set it to BEFORE_INITIAL_IMAGE instead of doing a
remove. That keeps the entry in the map and we just keep changing its value
from one canonical Integer to another.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)