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" />

     流程图

  • 相关阅读:
    php+GTK2 学习第二篇
    PHPMailer + qq邮箱 实现邮件发送
    HTTP状态码200、301、403、404、500等(转)
    LNMP环境搭建(转载)
    PHP+GTK2 初体验,简单计算器客户端
    mysql 用户权限管理(转)
    提高php执行效率的10条编程习惯(转)
    添加php拓展(以phppcntl及phpredis及phppcntl为例)
    centos7 &后台运行 受终端关闭影响问题
    sklearn学习笔记之简单线性回归
  • 原文地址:https://www.cnblogs.com/qcq0703/p/14985522.html
Copyright © 2011-2022 走看看