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() {
}
}
原创文章,欢迎转载,转载请注明出处!
把每一件简单的事情做好,就是不简单;把每一件平凡的事情做好,就是不平凡!相信自己,创造奇迹~~