当前位置:网站首页>Parler de threadlocal insecurerandom
Parler de threadlocal insecurerandom
2022-07-05 19:50:00 【Buster.】
Aujourd'hui, j'ai regardé la corrélation des nombres aléatoires,J'ai trouvé cette classe par inadvertance.
Ça a l'air super,Il y a un héritage.SecurityRandom,Encore.ThreadLocalMots,A - t - il les caractéristiques des deux,Est devenu un combinateur?
Voyons voir.
Voyons d'abord comment il génère des nombres aléatoires
@Override
public int nextInt() {
return random().nextInt();
}
Suivi,On dirait.randomL'approche est qu'elle est au cœur.
private static Random random() {
return PlatformDependent.threadLocalRandom();
}
PlatformDependent- Oui.nettyEn bas,On en reparlera plus tard.
Suivi
public static Random threadLocalRandom() {
return RANDOM_PROVIDER.current();
}
Suivi
private interface ThreadLocalRandomProvider {
Random current();
}
Suivi,Oh, mon Dieu.~
C'est ici. , À l'origine, le rez - de - chaussée était ThreadLocalRandomOh là là!,Pas démodéjdk7Et plus,AvecjdkLa façon dont.
static {
if (javaVersion() >= 7) {
RANDOM_PROVIDER = new ThreadLocalRandomProvider() {
@Override
@SuppressJava6Requirement(reason = "Usage guarded by java version check")
public Random current() {
return java.util.concurrent.ThreadLocalRandom.current();
}
};
} else {
RANDOM_PROVIDER = new ThreadLocalRandomProvider() {
@Override
public Random current() {
return ThreadLocalRandom.current();
}
};
}
J'ai regardé.nettyEtjdkEn basThreadLocalRandomMode de réalisation,Il y a encore une grande différence, Si vous êtes intéressé, allez voir par vous - même .
J'ai regardé en arrièreThreadLocalInsecureRandomPas encore.publicDécoré,Ce n'est rien.,La classe est finie..
边栏推荐
- 司空见惯 - 英雄扫雷鼠
- 建议收藏,我的腾讯Android面试经历分享
- The problem of returning the longtext field in MySQL and its solution
- 国海证券在网上开户安全吗?
- Hiengine: comparable to the local cloud native memory database engine
- 挖财钱堂教育靠谱安全吗?
- [C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
- Microwave radar induction module technology, real-time intelligent detection of human existence, static micro motion and static perception
- okcc呼叫中心有什么作用
- Reinforcement learning - learning notes 4 | actor critical
猜你喜欢
Django uses mysqlclient service to connect and write to the database
PHP利用ueditor实现上传图片添加水印
IBM大面积辞退40岁+的员工,掌握这十个搜索技巧让你的工作效率至上提高十倍
95后阿里P7晒出工资单:狠补了这个,真香...
Hiengine: comparable to the local cloud native memory database engine
成功入职百度月薪35K,2022Android开发面试解答
【合集- 行业解决方案】如何搭建高性能的数据加速与数据编排平台
使用easyexcel模板导出的两个坑(Map空数据列错乱和不支持嵌套对象)
如何安全快速地从 Centos迁移到openEuler
Base du réseau neuronal de convolution d'apprentissage profond (CNN)
随机推荐
如何安全快速地从 Centos迁移到openEuler
Inventory of the most complete low code / no code platforms in the whole network: Jiandao cloud, partner cloud, Mingdao cloud, Qingliu, xurong cloud, Jijian cloud, treelab, nailing · Yida, Tencent clo
毫米波雷达人体感应器,智能感知静止存在,人体存在检测应用
完爆面试官,一线互联网企业高级Android工程师面试题大全
深度学习 卷积神经网络(CNN)基础
[FAQ] summary of common causes and solutions of Huawei account service error 907135701
How MySQL queries and modifies JSON data
常用运算符与运算符优先级
深度學習 卷積神經網絡(CNN)基礎
[untitled]
Shell编程基础(第8篇:分支语句-case in)
UWB ultra wideband positioning technology, real-time centimeter level high-precision positioning application, ultra wideband transmission technology
Is it safe to open a mobile stock account? Is it reliable?
C application interface development foundation - form control (5) - grouping control
【obs】libobs-winrt :CreateDispatcherQueueController
Force buckle 1200 Minimum absolute difference
The difference between ID selector and class selector
集合
The problem of returning the longtext field in MySQL and its solution
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform