getConfigurationStore().openConfigurationStore(this, false);
getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.CREATED());
getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.STORE_LOCATION(getStorePath()));
ReplicatedEnvironmentFacade environmentFacade = (ReplicatedEnvironmentFacade) getConfigurationStore().getEnvironmentFacade();
if (environmentFacade == null)
{
throw new IllegalStateException("Environment facade is not created");
}
try
{
Set<ReplicationNode> remoteNodes = environmentFacade.getEnvironment().getGroup().getNodes();
for (ReplicationNode node : remoteNodes)
{
String nodeAddress = node.getHostName() + ":" + node.getPort();
if (!_permittedNodes.contains(nodeAddress))
{
getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.INTRUDER_DETECTED(node.getName(), nodeAddress));
shutdownOnIntruder(nodeAddress);
throw new IllegalStateException("Intruder node detected: " + nodeAddress);
}
}
}
catch (DatabaseException dbe)
{
environmentFacade.handleDatabaseException("DB exception while checking for intruder node", dbe);
}
if (_environmentFacade.compareAndSet(null, environmentFacade))
{
environmentFacade.setStateChangeListener(new EnvironmentStateChangeListener());
environmentFacade.setReplicationGroupListener(new RemoteNodesDiscoverer());
environmentFacade.setPermittedNodes(_permittedNodes);
}
}