StorageManager.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:concurrent 作者:
/**
 * 初始化类资源的存储空间
 * @param clz 类实例
 * @return
 */
private Storage initializeStorage(Class clz) {
    ResourceDefinition definition = this.definitions.get(clz);
    if (definition == null) {
        FormattingTuple message = MessageFormatter.format("静态资源[{}]的信息定义不存在,可能是配置缺失", clz.getSimpleName());
        logger.error(message.getMessage());
        throw new IllegalStateException(message.getMessage());
    }
    AutowireCapableBeanFactory beanFactory = this.applicationContext.getAutowireCapableBeanFactory();
    Storage storage = beanFactory.createBean(Storage.class);

    Storage prev = storages.putIfAbsent(clz, storage);
    if (prev == null) {
        storage.initialize(definition);
    }
    return prev == null ? storage : prev;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号