Dan Smith created GEODE-1816:
--------------------------------

             Summary: CacheServerLauncher uses static threadlocals to launch 
server
                 Key: GEODE-1816
                 URL: https://issues.apache.org/jira/browse/GEODE-1816
             Project: Geode
          Issue Type: Bug
          Components: management
            Reporter: Dan Smith


The CacheServerLauncher class has 3 static threadlocals 

{code}
  public static ThreadLocal<Integer> serverPort = new ThreadLocal<Integer>();

  public static ThreadLocal<String> serverBindAddress = new 
ThreadLocal<String>();

  public static ThreadLocal<Boolean> disableDefaultServer = new 
ThreadLocal<Boolean>();

{code}

These get set when a server is launched. Then down in CacheCreation.create, it 
reads these thread locals and uses them to add a cache server.

Unfortunately this causes lots of pain writing unit tests, because tests can 
end up setting these thread locals and they are never cleared. Statics and 
thread locals should pretty much never be used. Especially in this case it 
seems like there are several easy ways to create a cache server after the cache 
is created, or pass properties in while creating the cache.



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

Reply via email to