page.evaluateOnNewDocument(pageFunction, ...args) pageFunction <function|string> Function to be evaluated in browser context ...args <...Serializable> Arguments to pass to pageFunction returns: <Promise> Adds a function which would be in
背景: 最近在项目用到了ThreadLocal,存放一些值.起线程异步获取ThreadLocal中的值,得到null.这是由于,ThreadLocal.get()会获取当前线程的一个map对象,以ThreadLocal为key获取对象. demo: 这里定义了一个Person类,使用两个线程,一个向threadlocal set(),两个线程都使用threadLocal.get()获取存放的对象 其中一个线程没有获取到值 /** * Created by GuanXF on 2017/12/8.