• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConfigLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.hazelcast.config.ConfigLoader的典型用法代码示例。如果您正苦于以下问题:Java ConfigLoader类的具体用法?Java ConfigLoader怎么用?Java ConfigLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConfigLoader类属于com.hazelcast.config包,在下文中一共展示了ConfigLoader类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createHazelcastFullInstance

import com.hazelcast.config.ConfigLoader; //导入依赖的package包/类
/**
 * Create hazelcast full instance.
 *
 * @param configLocation the config location
 * @return the hazelcast instance
 */
public static HazelcastInstance createHazelcastFullInstance(String configLocation) {
    Config config;
    try {
        if (configLocation == null) {
            config = new XmlConfigBuilder().build();
        } else {
            config = ConfigLoader.load(configLocation);
        }
    } catch (IOException e) {
        throw new RuntimeException("failed to load config", e);
    }

    checkNotNull(config, "failed to find configLocation: " + configLocation);

    config.setInstanceName(DEFAULT_INSTANCE_NAME);
    return Hazelcast.getOrCreateHazelcastInstance(config);
}
 
开发者ID:hazelcast,项目名称:hazelcast-jetty-sessionmanager,代码行数:24,代码来源:JettySessionUtils.java


示例2: configure

import com.hazelcast.config.ConfigLoader; //导入依赖的package包/类
@Override
public void configure(final Properties props) {
    String instanceName = CacheEnvironment.getInstanceName(props);

    if (!StringUtil.isNullOrEmptyAfterTrim(instanceName)) {
        LOGGER.info("Using existing HazelcastInstance [" + instanceName + "].");
        this.existingInstanceName = instanceName;
    } else {
        String configResourcePath = CacheEnvironment.getConfigFilePath(props);
        if (!StringUtil.isNullOrEmptyAfterTrim(configResourcePath)) {
            try {
                this.config = ConfigLoader.load(configResourcePath);
            } catch (IOException e) {
                LOGGER.warning("IOException: " + e.getMessage());
            }
            if (config == null) {
                throw new CacheException("Could not find configuration file: " + configResourcePath);
            }
        } else {
            this.config = new XmlConfigBuilder().build();
        }
    }

    this.shutDown = CacheEnvironment.shutdownOnStop(props, (instanceName == null));
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:26,代码来源:HazelcastInstanceLoader.java


示例3: configure

import com.hazelcast.config.ConfigLoader; //导入依赖的package包/类
@Override
public void configure(Properties props) {
    String instanceName = CacheEnvironment.getInstanceName(props);

    if (!StringUtil.isNullOrEmptyAfterTrim(instanceName)) {
        LOGGER.info("Using existing HazelcastInstance [" + instanceName + "].");
        this.existingInstanceName = instanceName;
    } else {
        String configResourcePath = CacheEnvironment.getConfigFilePath(props);
        if (!StringUtil.isNullOrEmptyAfterTrim(configResourcePath)) {
            try {
                this.config = ConfigLoader.load(configResourcePath);
            } catch (IOException e) {
                LOGGER.warning("IOException: " + e.getMessage());
            }
            if (config == null) {
                throw new CacheException("Could not find configuration file: " + configResourcePath);
            }
        } else {
            this.config = new XmlConfigBuilder().build();
        }
    }

    this.shutDown = CacheEnvironment.shutdownOnStop(props, (instanceName == null));
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:26,代码来源:HazelcastInstanceLoader.java


示例4: getConfigUrl

import com.hazelcast.config.ConfigLoader; //导入依赖的package包/类
private static URL getConfigUrl(final ServletContext ctx, final String configLocation) {
    URL configUrl = null;
    try {
        configUrl = ctx.getResource(configLocation);
    } catch (MalformedURLException ignore) {
        LOGGER.info("Ignored MalformedURLException");
    }
    if (configUrl == null) {
        configUrl = ConfigLoader.locateConfig(configLocation);
    }
    if (configUrl == null) {
        throw new InvalidConfigurationException("Could not load configuration '" + configLocation + "'");
    }
    return configUrl;
}
 
开发者ID:hazelcast,项目名称:hazelcast-wm,代码行数:16,代码来源:WebFilterConfig.java


示例5: lifecycleEvent

import com.hazelcast.config.ConfigLoader; //导入依赖的package包/类
@Override
public void lifecycleEvent(LifecycleEvent event) {
    String shutdown = System.getProperty("hazelcast.tomcat.shutdown_hazelcast_instance");
    if (getConfigLocation() == null) {
        setConfigLocation("hazelcast-default.xml");
    }

    if ("start".equals(event.getType())) {
        try {
            config = ConfigLoader.load(getConfigLocation());
        } catch (IOException e) {
            throw new RuntimeException("failed to load Config:", e);
        }

        if (config == null) {
            throw new RuntimeException("failed to find configLocation:" + getConfigLocation());
        }
        if (config.getInstanceName() == null) {
            config.setInstanceName(SessionManager.DEFAULT_INSTANCE_NAME);
        }
        Hazelcast.getOrCreateHazelcastInstance(config);
    } else if ("stop".equals(event.getType()) && !"false".equals(shutdown)) {
        HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(SessionManager.DEFAULT_INSTANCE_NAME);
        if (instance != null) {
            instance.shutdown();
        }
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-tomcat-sessionmanager,代码行数:29,代码来源:P2PLifecycleListener.java


示例6: getConfigURL

import com.hazelcast.config.ConfigLoader; //导入依赖的package包/类
private static URL getConfigURL(final FilterConfig filterConfig, final String configLocation) throws ServletException {
    URL configUrl = null;
    try {
        configUrl = filterConfig.getServletContext().getResource(configLocation);
    } catch (MalformedURLException e) {
    }
    if (configUrl == null) {
        configUrl = ConfigLoader.locateConfig(configLocation);
    }

    if (configUrl == null) {
        throw new ServletException("Could not load configuration '" + configLocation + "'");
    }
    return configUrl;
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:16,代码来源:HazelcastInstanceLoader.java


示例7: ClientConfigBuilder

import com.hazelcast.config.ConfigLoader; //导入依赖的package包/类
public ClientConfigBuilder(String resource) throws IOException {
    super();
    URL url = ConfigLoader.locateConfig(resource);
    if (url == null) {
        throw new IllegalArgumentException("Could not load " + resource);
    }
    this.resource = resource;
    props.load(url.openStream());
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:10,代码来源:ClientConfigBuilder.java


示例8: loadInstance

import com.hazelcast.config.ConfigLoader; //导入依赖的package包/类
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;
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:53,代码来源:HazelcastInstanceLoader.java



注:本文中的com.hazelcast.config.ConfigLoader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JCSMPSession类代码示例发布时间:2022-05-22
下一篇:
Java InternalCompletionProposal类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap