@Category(FlakyTest.class) @Test public void testStartTwoLocators() throws Exception {
  disconnectAllFromDS();
  Host host=Host.getHost(0);
  VM loc1=host.getVM(1);
  VM loc2=host.getVM(2);
  int ports[]=AvailablePortHelper.getRandomAvailableTCPPorts(2);
  final int port1=ports[0];
  this.port1=port1;
  final int port2=ports[1];
  this.port2=port2;
  DistributedTestUtils.deleteLocatorStateFile(port1);
  DistributedTestUtils.deleteLocatorStateFile(port2);
  final String host0=NetworkUtils.getServerHostName(host);
  final String locators=host0 + "[" + port1+ "],"+ host0+ "["+ port2+ "]";
  final Properties properties=new Properties();
  properties.put(MCAST_PORT,"0");
  properties.put(LOCATORS,locators);
  properties.put(ENABLE_NETWORK_PARTITION_DETECTION,"false");
  properties.put(DISABLE_AUTO_RECONNECT,"true");
  properties.put(MEMBER_TIMEOUT,"2000");
  properties.put(LOG_LEVEL,LogWriterUtils.getDUnitLogLevel());
  properties.put(ENABLE_CLUSTER_CONFIGURATION,"false");
  addDSProps(properties);
  try {
    loc2.invoke("startLocator2",null);
    loc1.invoke("startLocator1",null);
  }
  finally {
    try {
      loc2.invoke("verifyLocatorNotInSplitBrain",null);
      loc1.invoke("verifyLocatorNotInSplitBrain",null);
    }
  finally {
      loc2.invoke("stop locator",null);
      loc1.invoke("stop locator",null);
    }
  }
}

@ Category ( FlakyTest . class ) @ Test public void testStartTwoLocators ( ) throws Exception { disconnectAllFromDS ( ) ; Host host = Host . getHost ( 0 ) ; VM loc1 = host . getVM ( 1 ) ; VM loc2 = host . getVM ( 2 ) ; int ports [ ] = AvailablePortHelper . getRandomAvailableTCPPorts ( 2 ) ; final int port1 = ports [ 0 ] ; this . port1 = port1 ; final int port2 = ports [ 1 ] ; this . port2 = port2 ; DistributedTestUtils . deleteLocatorStateFile ( port1 ) ; DistributedTestUtils . deleteLocatorStateFile ( port2 ) ; final String host0 = NetworkUtils . getServerHostName ( host ) ; final String locators = host0 + "[" + port1 + "]," + host0 + "[" + port2 + "]" ; final Properties properties = new Properties ( ) ; properties . put ( MCAST_PORT , "0" ) ; properties . put ( LOCATORS , locators ) ; properties . put ( ENABLE_NETWORK_PARTITION_DETECTION , "false" ) ; properties . put ( DISABLE_AUTO_RECONNECT , "true" ) ; properties . put ( MEMBER_TIMEOUT , "2000" ) ; properties . put ( LOG_LEVEL , LogWriterUtils . getDUnitLogLevel ( ) ) ; properties . put ( ENABLE_CLUSTER_CONFIGURATION , "false" ) ; addDSProps ( properties ) ; try { loc2 . invoke ( "startLocator2" , null ) ; loc1 . invoke ( "startLocator1" , null ) ; } finally { try { loc2 . invoke ( "verifyLocatorNotInSplitBrain" , null ) ; loc1 . invoke ( "verifyLocatorNotInSplitBrain" , null ) ; } finally { loc2 . invoke ( "stop locator" , null ) ; loc1 . invoke ( "stop locator" , null ) ; } } }
bug 30341 concerns race conditions in jgroups that allow two locators to start up in a split - brain configuration . to work around this we have always told customers that they need to stagger the starting of locators . this test configures two locators to start up simultaneously and shows that they find each other and form a single system .
