Bill Burcham created GEODE-7449:
-----------------------------------

             Summary: Eliminate SocketCreatorFactory Singleton
                 Key: GEODE-7449
                 URL: https://issues.apache.org/jira/browse/GEODE-7449
             Project: Geode
          Issue Type: Bug
          Components: security
            Reporter: Bill Burcham


{{SocketCreatorFactory}} is primarily accessed through a singleton. The 
"module" is initialized via the static {{setDistributionConfig()}} method and 
de-initialized via the static {{close()}} method. Unfortunately though, a call 
to {{setDistributionConfig()}} is insufficient to fully initialize the 
singleton since doing so does not initialize (clear) the 
{{Map<SecurableCommunicationChannel, SocketCreator> socketCreators}} field.

This bites in tests. If a test interacts with the singleton and fails to call 
{{SocketCreatorFactory.close()}} at the end, then subsequent tests, which are 
merely calling {{setDistributionConfig()}} are starting with a 
{{socketCreators}} map that is in some indeterminate state. The obvious 
solution, of clearing the map in {{setDistributionConfig()}} is problematic 
because there are other static methods on the class that may be relying on the 
state of that map.

So rather than spending effort trying to shore up the static interface to the 
singleton, this ticket proposes eliminating the singleton (global variable) 
entirely. Clients that need a {{SocketCreatorFactory}} should use one. They 
should interact with it solely through instance methods.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to