Java 类com.hazelcast.core.DuplicateInstanceNameException 实例源码

项目:hazelcast-hibernate5    文件:HazelcastMockInstanceLoader.java   
private void createOrGetInstance() throws DuplicateInstanceNameException {
    if (config == null) {
        config = new XmlConfigBuilder().build();
    }
    config.setInstanceName(instanceName);
    instance = factory.newHazelcastInstance(config);
}
项目:hazelcast-hibernate    文件:HazelcastMockInstanceLoader.java   
private void createOrGetInstance() throws DuplicateInstanceNameException {
    if (config == null) {
        config = new XmlConfigBuilder().build();
    }
    config.setInstanceName(instanceName);
    instance = factory.newHazelcastInstance(config);
}
项目:hazelcast-hibernate    文件:HazelcastMockInstanceLoader.java   
private void createOrGetInstance() throws DuplicateInstanceNameException {
    if (config == null) {
        config = new XmlConfigBuilder().build();
    }
    config.setInstanceName(instanceName);
    instance = factory.newHazelcastInstance(config);
}
项目:hazelcast-archive    文件:HazelcastInstanceLoader.java   
private void createOrGetInstance() throws DuplicateInstanceNameException {
    if (staticInstance) {
        instance = Hazelcast.getDefaultInstance();
    } else {
        if (config == null) {
            config = new XmlConfigBuilder().build();
        }
        config.setInstanceName(instanceName);
        config.setLiteMember(useLiteMember);
        instance = Hazelcast.newHazelcastInstance(config);
    }
}
项目:health-and-care-developer-network    文件:HazelcastInstanceLoader.java   
private void createOrGetInstance() throws DuplicateInstanceNameException {
    if (staticInstance) {
        instance = Hazelcast.getDefaultInstance();
    } else {
        if (config == null) {
            config = new XmlConfigBuilder().build();
        }
        config.setInstanceName(instanceName);
        config.setLiteMember(useLiteMember);
        instance = Hazelcast.newHazelcastInstance(config);
    }
}
项目:hazelcast-archive    文件:HazelcastInstanceLoader.java   
public HazelcastInstance loadInstance() throws CacheException {
    if (instance != null && instance.getLifecycleService().isRunning()) {
        logger.log(Level.WARNING, "Current HazelcastInstance is already loaded and running! " +
                "Returning current instance...");
        return instance;
    }
    String configResourcePath = null;
    if (props != null) {
        instanceName = CacheEnvironment.getInstanceName(props);
        useLiteMember = CacheEnvironment.isLiteMember(props);
        if (!useLiteMember && props.contains(CacheEnvironment.USE_SUPER_CLIENT)) {
            useLiteMember = CacheEnvironment.isSuperClient(props);
            logger.log(Level.WARNING, "'" + CacheEnvironment.USE_SUPER_CLIENT + "' property is deprecated!" +
                    " Please use '" + CacheEnvironment.USE_LITE_MEMBER + "' instead...");
        }
        configResourcePath = CacheEnvironment.getConfigFilePath(props);
    }
    if (useLiteMember) {
        logger.log(Level.WARNING,
                "Creating Hazelcast node as Lite-Member. "
                        + "Be sure this node has access to an already running cluster...");
    }
    if (StringHelper.isEmpty(configResourcePath)) {
        // If both useLiteMember and instanceName is not set
        // then just use default instance.
        if (!useLiteMember && instanceName == null) {
            staticInstance = true;
        }
    } else {
        URL url = ConfigHelper.locateConfig(configResourcePath);
        try {
            config = new UrlXmlConfig(url);
        } catch (IOException e) {
            throw new CacheException(e);
        }
    }
    if (instanceName != null) {
        instance = Hazelcast.getHazelcastInstanceByName(instanceName);
        if (instance == null) {
            try {
                createOrGetInstance();
            } catch (DuplicateInstanceNameException ignored) {
                instance = Hazelcast.getHazelcastInstanceByName(instanceName);
            }
        }
    } else {
        createOrGetInstance();
    }
    return instance;
}
项目:health-and-care-developer-network    文件:HazelcastInstanceLoader.java   
public HazelcastInstance loadInstance() throws CacheException {
    if (instance != null && instance.getLifecycleService().isRunning()) {
        logger.log(Level.WARNING, "Current HazelcastInstance is already loaded and running! " +
                "Returning current instance...");
        return instance;
    }
    String configResourcePath = null;
    if (props != null) {
        instanceName = CacheEnvironment.getInstanceName(props);
        useLiteMember = CacheEnvironment.isLiteMember(props);
        if (!useLiteMember && props.contains(CacheEnvironment.USE_SUPER_CLIENT)) {
            useLiteMember = CacheEnvironment.isSuperClient(props);
            logger.log(Level.WARNING, "'" + CacheEnvironment.USE_SUPER_CLIENT + "' property is deprecated!" +
                    " Please use '" + CacheEnvironment.USE_LITE_MEMBER + "' instead...");
        }
        configResourcePath = CacheEnvironment.getConfigFilePath(props);
    }
    if (useLiteMember) {
        logger.log(Level.WARNING,
                "Creating Hazelcast node as Lite-Member. "
                        + "Make sure this node has access to an already running cluster...");
    }
    if (isEmpty(configResourcePath)) {
        // If both useLiteMember and instanceName is not set
        // then just use default instance.
        if (!useLiteMember && instanceName == null) {
            staticInstance = true;
        }
    } else {
        try {
            config = ConfigLoader.load(configResourcePath);
        } catch (IOException e) {
            logger.log(Level.WARNING, "IOException: " + e.getMessage());
        }
        if (config == null) {
            throw new CacheException("Could not find configuration file: " + configResourcePath);
        }
    }
    if (instanceName != null) {
        instance = Hazelcast.getHazelcastInstanceByName(instanceName);
        if (instance == null) {
            try {
                createOrGetInstance();
            } catch (DuplicateInstanceNameException ignored) {
                instance = Hazelcast.getHazelcastInstanceByName(instanceName);
            }
        }
    } else {
        createOrGetInstance();
    }
    return instance;
}