Skip to content

rogersdjl/send-book-to-kindle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ThreadLocal 变量和 与线程池配合使用时可能会出现的问题

先看下ThreadLocal变量的使用

public void set(T value) {
        Thread t = Thread.currentThread();
        ThreadLocalMap map = getMap(t);
        if (map != null)
            map.set(this, value);
        else
            createMap(t, value);
    }	



[java]
public T get() {
    Thread t = Thread.currentThread();
    ThreadLocalMap map = getMap(t);
    if (map != null) {
        ThreadLocalMap.Entry e = map.getEntry(this);
        if (e != null) {
            @SuppressWarnings("unchecked")
            T result = (T)e.value;
            return result;
        }
    }
    return setInitialValue();
}

About

一个自用的发送书籍到kindle的python项目

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published