放入ThreadLocal的上下文信息.
516756
public static void put(String key, Object value) {
		contextMap.get().put(key, value);
	}
1262426
private HttpLocalFormat getFormat() {
        HttpLocalFormat format = threadStorage.get();
        if (null == format) {
            format = new HttpLocalFormat();
            threadStorage.set(format);
        }
        return format;
    }
316100
def get_thread(self, thread_key):
		'''
		'''
		uri = '/'.join([self.api_uri,
						self.threads_suffix,
						thread_key
						])
		return self._req('get', uri)
1197297
function(threadId, callback) {
                var uploadQ = [];
                for (var i = 0; i < chatUploadQueue.length; i++) {
                    if (chatUploadQueue[i].threadId == threadId) {
                        uploadQ.push(chatUploadQueue[i]);
                    }
                }

                callback && callback(chatUploadQueue);
            }
131569
def threadProfileCode(func, *args, **kwargs):
    ''
    with ThreadProfiler(threading.current_thread()) as prof:
        try:
            prof.thread.status = threadProfileCode.__wrapped__(func, *args, **kwargs)
        except EscapeException as e:
            prof.thread.status = e
28102
private LocalThreadObjectPool getThreadLocalObjectPool() {
        if (threadPoolSize <= 0) {
            // no local thread pool needed.
            return null;
        }
        LocalThreadObjectPool localPool = null;
        if (threadLocals != null) {
            localPool = threadLocals.get();
            if (localPool == null) {
                localPool = new LocalThreadObjectPool(threadPoolSize, null, destroyer); // @PK36998C
                threadLocals.set(localPool);

                localPool.setCleanUpOld(cleanUpOld);
            }
        }

        return localPool;
    }
422281
def threadpooled(
    func: None = None,
    *,
    loop_getter: typing.Union[None, typing.Callable[..., asyncio.AbstractEventLoop], asyncio.AbstractEventLoop] = None,
    loop_getter_need_context: bool = False,
) -> ThreadPooled:
    """"""
312281
def get_thread(self, dwThreadId):
        
        self.__initialize_snapshot()
        if dwThreadId not in self.__threadDict:
            msg = "Unknown thread ID: %d" % dwThreadId
            raise KeyError(msg)
        return self.__threadDict[dwThreadId]
111745
def build_exception_info_response(dbg, thread_id, request_seq, set_additional_thread_info, iter_visible_frames_info, max_frames):
    '''
    
    '''
    thread = pydevd_find_thread_by_id(thread_id)
    additional_info = set_additional_thread_info(thread)
    topmost_frame = additional_info.get_topmost_frame(thread)

    frames = []
    exc_type = None
    exc_desc = None
    if topmost_frame is not None:
        frame_id_to_lineno = {}
        try:
            trace_obj = None
            frame = topmost_frame
            while frame is not None:
                if frame.f_code.co_name == 'do_wait_suspend' and frame.f_code.co_filename.endswith('pydevd.py'):
                    arg = frame.f_locals.get('arg', None)
                    if arg is not None:
                        exc_type, exc_desc, trace_obj = arg
                        break
                frame = frame.f_back

            while trace_obj.tb_next is not None:
                trace_obj = trace_obj.tb_next

            info = dbg.suspended_frames_manager.get_topmost_frame_and_frame_id_to_line(thread_id)
            if info is not None:
                topmost_frame, frame_id_to_lineno = info

            if trace_obj is not None:
                for frame_id, frame, method_name, original_filename, filename_in_utf8, lineno in iter_visible_frames_info(
                        dbg, trace_obj.tb_frame, frame_id_to_lineno):

                    line_text = linecache.getline(original_filename, lineno)

                    # Never filter out plugin frames!
                    if not getattr(frame, 'IS_PLUGIN_FRAME', False):
                        if dbg.is_files_filter_enabled and dbg.apply_files_filter(frame, original_filename, False):
                            continue
                    frames.append((filename_in_utf8, lineno, method_name, line_text))
        finally:
            topmost_frame = None

    name = 'exception: type unknown'
    if exc_type is not None:
        try:
            name = exc_type.__qualname__
        except:
            try:
                name = exc_type.__name__
            except:
                try:
                    name = str(exc_type)
                except:
                    pass

    description = 'exception: no description'
    if exc_desc is not None:
        try:
            description = str(exc_desc)
        except:
            pass

    stack_str = ''.join(traceback.format_list(frames[-max_frames:]))

    # This is an extra bit of data used by Visual Studio
    source_path = frames[0][0] if frames else ''

    if thread.stop_reason == CMD_STEP_CAUGHT_EXCEPTION:
        break_mode = pydevd_schema.ExceptionBreakMode.ALWAYS
    else:
        break_mode = pydevd_schema.ExceptionBreakMode.UNHANDLED

    response = pydevd_schema.ExceptionInfoResponse(
        request_seq=request_seq,
        success=True,
        command='exceptionInfo',
        body=pydevd_schema.ExceptionInfoResponseBody(
            exceptionId=name,
            description=description,
            breakMode=break_mode,
            details=pydevd_schema.ExceptionDetails(
                message=description,
                typeName=name,
                stackTrace=stack_str,
                source=source_path
            )
        )
    )
    return response
286902
static final void eraseThreadLocals(Thread thread) {
    U.putObject(thread, THREADLOCALS, null);
    U.putObject(thread, INHERITABLETHREADLOCALS, null);
  }
557703
def run_on_ui_thread(f):
    '''
    '''
    def f2(*args, **kwargs):
        Runnable(f)(*args, **kwargs)
    return f2
1157129
def run_locally(self):
        """"""
        self.thread = threading.Thread(target=self.execute_locally)
        self.thread.daemon = True # So that they die when we die
        self.thread.start()
806617
def _get_local_dict(self):
        """"""
        try:
            return getattr(THREAD_STORE, self.namespace)
        except AttributeError:
            local_var = dict(*self.args, **self.kwargs)
            setattr(THREAD_STORE, self.namespace, local_var)
            return local_var
684544
private static Calendar _getThreadCalendar(Locale l, TimeZone tz) {
	Calendar c = _localeCalendar.get(tz, l);
	if (tz == null) tz = ThreadLocalPageContext.getTimeZone();
	c.setTimeZone(tz);
	return c;
    }
949033
def dump_threads(stream=None):
    '''
    
    '''
    if stream is None:
        stream = sys.stderr
    thread_id_to_name = {}
    try:
        for t in threading.enumerate():
            thread_id_to_name[t.ident] = '%s  (daemon: %s, pydevd thread: %s)' % (
                t.name, t.daemon, getattr(t, 'is_pydev_daemon_thread', False))
    except:
        pass

    from _pydevd_bundle.pydevd_additional_thread_info_regular import _current_frames

    stream.write('===============================================================================\n')
    stream.write('Threads running\n')
    stream.write('================================= Thread Dump =================================\n')
    stream.flush()

    for thread_id, stack in _current_frames().items():
        stream.write('\n-------------------------------------------------------------------------------\n')
        stream.write(" Thread %s" % thread_id_to_name.get(thread_id, thread_id))
        stream.write('\n\n')

        for i, (filename, lineno, name, line) in enumerate(traceback.extract_stack(stack)):

            stream.write(' File "%s", line %d, in %s\n' % (filename, lineno, name))
            if line:
                stream.write("   %s\n" % (line.strip()))

            if i == 0 and 'self' in stack.f_locals:
                stream.write('   self: ')
                try:
                    stream.write(str(stack.f_locals['self']))
                except:
                    stream.write('Unable to get str of: %s' % (type(stack.f_locals['self']),))
                stream.write('\n')
        stream.flush()

    stream.write('\n=============================== END Thread Dump ===============================')
    stream.flush()
690100
public static long getThreadId() {
        final Long threadId = THREAD_LOCAL.get();
        if (threadId != null) {
            return threadId;
        }
        return Thread.currentThread().getId();
    }
995198
def get_selected_thread(self):
        """"""
        threadlinewidget = self.get_selected_threadline()
        thread = None
        if threadlinewidget:
            thread = threadlinewidget.get_thread()
        return thread