当多线程访问共享可变数据时,涉及到线程间同步的问题,并不是所有时候,都要用到共享数据,所以就需要线程封闭出场了。数据都被封闭在各自的线程之中,就不需要同步,这种通过将数据封闭在线程中而避免使用同步的技术称为线程封闭。本文主要介绍线程封闭中的其中一种体现:ThreadLocal,将会介绍什么是ThreadLocal;从ThreadLocal源码角度分析,最后介绍ThreadLocal的应用场景。什么
分类:
其他好文 时间:
2020-08-26 18:39:20
阅读次数:
42
二叉树节点函数定义: /** * Definition for a binary tree node. */ function TreeNode(val){ this.val = val; this.left = this.right = null; } 层次遍历构建二叉树(广度优先) functi ...
分类:
其他好文 时间:
2020-08-26 18:35:16
阅读次数:
74
知识点一:数据类型 1、数据类型: (1)、基本数据类型:数字类型(Number)、字符串类型(String)、布尔类型(Boolean)、Undefined、null (2)、复杂数据类型:对象(Object) 2、Number ① 十进制 var num1 = -100.25; ② 十六进制 v ...
分类:
编程语言 时间:
2020-08-26 18:31:13
阅读次数:
54
参考:https://segmentfault.com/a/1190000019301545 export default { data() { return { websock: null, } }, created(){ //页面刚进入时开启长连接 this.initWebSocket() }, ...
分类:
Web程序 时间:
2020-08-25 18:27:46
阅读次数:
60
'''json 是数据存储和交换文本信息的语法javaScript对象表示法用于数据传递json中的数据格式 python中的数据 数字 整型 浮点数 字符串 字符串 布尔值 true false True False 数组 列表。元祖 对象 字典 null None 常见的json数据格式 { c ...
分类:
编程语言 时间:
2020-08-25 16:02:52
阅读次数:
60
一.mysql 优化之is null ,is not null 索引使用测试 1.创建t_user表,在name字段创建索引,且name字段不能为null。 EXPLAIN select * from t_user where name is not null;//不使用索引; EXPLAIN se ...
分类:
数据库 时间:
2020-08-25 16:01:53
阅读次数:
49
1.前言欢迎阅读SpringSecurity实战干货系列文章,在集成SpringSecurity安全框架的时候我们最先处理的可能就是根据我们项目的实际需要来定制注册登录了,尤其是Http登录认证。根据以前的相关文章介绍,Http登录认证由过滤器UsernamePasswordAuthenticationFilter进行处理。我们只有把这个过滤器搞清楚才能做一些定制化。今天我们就简单分析它的源码和工
分类:
编程语言 时间:
2020-08-24 16:52:00
阅读次数:
72
###关键字总览 访问控制 private protected public 类,方法和变量修饰符 abstract class extends final implements interface native new static strictfp synchronized transient ...
分类:
编程语言 时间:
2020-08-24 16:33:44
阅读次数:
46
// 初始化 快指针和慢指针 ListNode slow = head; ListNode fast = head; /** * Change this condition to fit specific problem. * 在这里避免空指针错误 **/ while (slow != null & ...
分类:
其他好文 时间:
2020-08-20 18:57:19
阅读次数:
66
int height(struct TreeNode* root) { if (root == NULL) { return 0; } else { return fmax(height(root->left), height(root->right)) + 1; } } bool isBalanc ...
分类:
其他好文 时间:
2020-08-19 19:58:57
阅读次数:
65