[ 
https://issues.apache.org/jira/browse/GEODE-6562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirk Lund updated GEODE-6562:
-----------------------------
    Description: 
This is observable with MultipleCacheJUnitTest: 
{noformat}
57:  @Before
58:  public void startLocator() throws IOException {
59:    InternalDistributedSystem.ALLOW_MULTIPLE_SYSTEMS = true;
60:    locator = Locator.startLocatorAndDS(0, 
locatorFolder.newFile("locator.log"), null);
61:    props = new Properties();
62:    props.setProperty(ConfigurationProperties.LOCATORS, "locahost[" + 
locator.getPort() + "]");
63:  }
{noformat}
InternalLocator.startDistributedSystem() creates a DS connection and then 
passes it to startCache:
{noformat}
597:  private void startDistributedSystem() throws UnknownHostException {
...
648:      this.myDs = (InternalDistributedSystem) 
DistributedSystem.connect(connectEnv);
...
661:      startCache(myDs);
{noformat}
But then InternalLocator.startCache(DistributedSystem) creates a new Cache 
without using the DistributedSystem passed in (it only uses its properties):
{noformat}
670:  private void startCache(DistributedSystem ds) {
...
674:      this.myCache = (InternalCache) new 
CacheFactory(ds.getProperties()).create();
{noformat}
Because of the way that CacheFactory was implemented to support 
ALLOW_MULTIPLE_SYSTEMS, it always creates a new instance of DistributedSystem. 
That old behavior was carried forward to the new InternalCacheBuilder.

  was:
This is observable with MultipleCacheJUnitTest: 
{noformat}
1:  @Before
2:  public void startLocator() throws IOException {
3:    InternalDistributedSystem.ALLOW_MULTIPLE_SYSTEMS = true;
4:    locator = Locator.startLocatorAndDS(0, 
locatorFolder.newFile("locator.log"), null);
5:    props = new Properties();
6:    props.setProperty(ConfigurationProperties.LOCATORS, "locahost[" + 
locator.getPort() + "]");
7:  }
{noformat}
InternalLocator.startDistributedSystem() creates a DS connection and then 
passes it to startCache:
{noformat}
597:  private void startDistributedSystem() throws UnknownHostException {
...
648:      this.myDs = (InternalDistributedSystem) 
DistributedSystem.connect(connectEnv);
...
661:      startCache(myDs);
{noformat}
But then InternalLocator.startCache(DistributedSystem) creates a new Cache 
without using the DistributedSystem passed in (it only uses its properties):
{noformat}
670:  private void startCache(DistributedSystem ds) {
...
674:      this.myCache = (InternalCache) new 
CacheFactory(ds.getProperties()).create();
{noformat}
Because of the way that CacheFactory was implemented to support 
ALLOW_MULTIPLE_SYSTEMS, it always creates a new instance of DistributedSystem. 
That old behavior was carried forward to the new InternalCacheBuilder.


> Locator.startLocatorAndDS creates two DistributedSystem connections when 
> ALLOW_MULTIPLE_SYSTEMS is true
> -------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-6562
>                 URL: https://issues.apache.org/jira/browse/GEODE-6562
>             Project: Geode
>          Issue Type: Bug
>          Components: core
>            Reporter: Kirk Lund
>            Assignee: Dan Smith
>            Priority: Minor
>
> This is observable with MultipleCacheJUnitTest: 
> {noformat}
> 57:  @Before
> 58:  public void startLocator() throws IOException {
> 59:    InternalDistributedSystem.ALLOW_MULTIPLE_SYSTEMS = true;
> 60:    locator = Locator.startLocatorAndDS(0, 
> locatorFolder.newFile("locator.log"), null);
> 61:    props = new Properties();
> 62:    props.setProperty(ConfigurationProperties.LOCATORS, "locahost[" + 
> locator.getPort() + "]");
> 63:  }
> {noformat}
> InternalLocator.startDistributedSystem() creates a DS connection and then 
> passes it to startCache:
> {noformat}
> 597:  private void startDistributedSystem() throws UnknownHostException {
> ...
> 648:      this.myDs = (InternalDistributedSystem) 
> DistributedSystem.connect(connectEnv);
> ...
> 661:      startCache(myDs);
> {noformat}
> But then InternalLocator.startCache(DistributedSystem) creates a new Cache 
> without using the DistributedSystem passed in (it only uses its properties):
> {noformat}
> 670:  private void startCache(DistributedSystem ds) {
> ...
> 674:      this.myCache = (InternalCache) new 
> CacheFactory(ds.getProperties()).create();
> {noformat}
> Because of the way that CacheFactory was implemented to support 
> ALLOW_MULTIPLE_SYSTEMS, it always creates a new instance of 
> DistributedSystem. That old behavior was carried forward to the new 
> InternalCacheBuilder.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to