zoukankan      html  css  js  c++  java
  • httpcore Immutable 升级替代方法

    httpcore 包

    <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${httpcore.version}</version>
    </dependency>

    4.4.4 版本里有个Immutable 注解

    @Documented
    @Target({ElementType.TYPE})
    @Retention(RetentionPolicy.CLASS)
    public @interface Immutable {
    }

    4.4.13 版本里已经没有这个注解了
    用@Contract(threading = ThreadingBehavior.SAFE) 替代

    @Documented
    @Target({ElementType.TYPE})
    @Retention(RetentionPolicy.CLASS)
    public @interface Contract {
        ThreadingBehavior threading() default ThreadingBehavior.UNSAFE;
    }
    
    
    public enum ThreadingBehavior {
        IMMUTABLE,
        IMMUTABLE_CONDITIONAL,
        SAFE,
        SAFE_CONDITIONAL,
        UNSAFE;
    
        private ThreadingBehavior() {
        }
    }

    原创文章,欢迎转载,转载请注明出处!

    把每一件简单的事情做好,就是不简单;把每一件平凡的事情做好,就是不平凡!相信自己,创造奇迹~~
  • 相关阅读:
    九九乘法表
    杨辉三角
    显示计算机界面
    完善3.2
    杨辉三角形
    100以内的素数
    九九乘法表
    杨辉三角
    九九乘法表
    杨辉三角形
  • 原文地址:https://www.cnblogs.com/acm-bingzi/p/httpcore_immutable.html
Copyright © 2011-2022 走看看