zoukankan      html  css  js  c++  java
  • 新项目新知识总结02

    JUC的AtomicReference

    ①.AtomicReference和AtomicInteger非常类似,不同之处就在于AtomicInteger是对整数的封装,而AtomicReference则对应普通的对象引用。也就是它可以保证你在修改对象引用时的线程安全性。
    
    ②.AtomicReference是作用是对”对象”进行原子操作。 提供了一种读和写都是原子性的对象引用变量。原子意味着多个线程试图改变同一个AtomicReference(例如比较和交换操作)将不会使得AtomicReference处于不一致的状态。

    上传阿里云

    @Override
        public void uploadImgToOSS(ImportAssetsSaveRequest assetsSaveRequest) {
            String pare = assetsSaveRequest.getProjectId()+"/";
            assetsSaveRequest.getImportAssets().forEach(importShot -> {
                if(importShot.getAssetsImgFile() != null){
                    String filePatch = importShot.getAssetsImg();
                    String imgUrl = aliOssServiceI.upload(importShot.getAssetsImgFile() , pare + (StringUtil.isBlank(importShot.getAssetsName()) ? importShot.getTaskSubLinkName() : importShot.getAssetsName()) +"/"+importShot.getFileName() );
                    importShot.setAssetsImg(imgUrl);
                    logger.info("上传文件至阿里云:{},上传后路径{}" , filePatch , importShot.getAssetsImg());
                }
            });
        }
    @Service暴露的服务接口
    import org.apache.dubbo.config.annotation.Service;
    在暴露的服务接口实现类中使用

    @Reference引用服务

    @Reference
    private SystemUserRestServicesI systemUserRestServicesI;
    <!-- 配置包扫描器,alibaba的@Service注解 -->
    <dubbo:annotation package="com.zm.service" />
    
    <!-- 提供方应用信息,用于计算依赖关系 -->
    <dubbo:application name="e3-manager" />
    <dubbo:registry protocol="zookeeper" address="127.0.0.1:2181" />
    <!-- 用dubbo协议在20880端口暴露服务 -->
    <dubbo:protocol name="dubbo" port="20880" />

     流程图

  • 相关阅读:
    FirewallD 详解
    EventBus源码解析
    详谈 Jquery Ajax 异步处理Json数据.
    jQuery Ajax异步处理Json数据详解
    7款jQuery图片轮播滑动插件
    分享15款为jQuery Mobile定制的插件
    在springmvc中解决FastJson循环引用的问题
    SpringMVC与fastjson整合并同时解决中文乱码问题
    SpringMVC处理ajax请求
    spring mvc 返回json的配置
  • 原文地址:https://www.cnblogs.com/qcq0703/p/14985522.html
Copyright © 2011-2022 走看看