geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barbara Pruijn (JIRA)" <>
Subject [jira] [Resolved] (GEODE-1816) CacheServerLauncher uses static threadlocals to launch server
Date Tue, 27 Feb 2018 20:55:00 GMT


Barbara Pruijn resolved GEODE-1816.
    Resolution: Won't Do

Is this still an issue?

> CacheServerLauncher uses static threadlocals to launch server
> -------------------------------------------------------------
>                 Key: GEODE-1816
>                 URL:
>             Project: Geode
>          Issue Type: Bug
>          Components: management
>            Reporter: Dan Smith
>            Priority: Major
> 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

View raw message