lexburner / java-interview-summary Goto Github PK
View Code? Open in Web Editor NEWjava 程序员面试指南,常用面试题汇总解答
java 程序员面试指南,常用面试题汇总解答
摘抄了你的描述如下:
ThreadLocal 常用于维护线程私有化变量,解决线程安全问题。其内部维护了一个 ThreadLocalMap,使用 Thread 作为 key,ThreadLocal.set 的值作为 value。
纠正如下:
Thread中维护一个ThreadLocalMap,该Map的key为ThreadLocal实例,value为对应set的值。
当获取ThreadLocal中的值时:获取当前线程的ThreadLocalMap,以当前ThreadLocal实例为key
,get出所存储的值。
ps:这里会有个坑,因为ThreadLocalMap中用Entity具体实现,Entity继承WeakReference。所以key值ThreadLocal<?> 采用的是弱引用。所以再GC时会被回收。当回收后Map中的大量value数据无发被remove,且valud存在强引用,导致内存溢出。不过ThreadLocal再remove时增加了一个处理,remove会check所有key为null的,将value赋值为null。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.