`
niumd
  • 浏览: 288657 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
    本文借花献佛,引用Tim Cull的博文“SimpleDateFormat: Performance Pig”介绍下ThreadLocal的简单使用,同时也对SimpleDateFormat的使用有个深入的了解。 Tim Cull 写道 Just yesterday I came across this problem “in the wild” for the third time in my career so far: an application with performance problems creating tons of java.text.SimpleDateFo ...
一、ThreadLocal概述        学习JDK中的类,首先看下JDK API对此类的描述,描述如下: JDK API 写道 该类提供了线程局部 (thread-local) 变量。这些变量不同于它们的普通对应物,因为访问某个变量(通过其 get 或 set 方法)的每个线程都有自己的局部变量,它独立于变量的初始化副本。ThreadLocal 实例通常是类中的 private static 字段,它们希望将状态与某一个线程(例如,用户 ID 或事务 ID)相关联。     API表达了下面几种观点: 1、ThreadLocal不是线程,是线程的一个变量,你可以先简单理解为线 ...
Global site tag (gtag.js) - Google Analytics