• Listing 1 shows the ThreadLocal interface.

    清单1显示ThreadLocal接口。

    youdao

  • Using ThreadLocal to simplify debug logging.

    ThreadLocal简化调试日志纪录

    youdao

  • Listing 2 shows one way to implement ThreadLocal.

    清单2显示了ThreadLocal一个实现方式

    youdao

  • Needless to say, the performance of ThreadLocal was quite poor.

    不用说ThreadLocal性能相当差的

    youdao

  • To create a thread-local variable, you instantiate an object of class ThreadLocal.

    创建线程局部变量实例化ThreadLocal对象

    youdao

  • In this way, we can think of a ThreadLocal as allowing us to create a per-thread-singleton.

    这样我们可以认为ThreadLocal允许我们创建每线程单子。

    youdao

  • With these new improvements, ThreadLocal should be faster than other techniques such as pooling.

    有了这些提高ThreadLocal应该其它技术用池更快

    youdao

  • Using ThreadLocal makes sense when you need to store variable instances on a per-thread basis.

    需要以线程为单位存储变量实例时,使用ThreadLocal有意义

    youdao

  • For a discussion on the use of ThreadLocal, see Exploiting ThreadLocal to enhance scalability.

    有关ThreadLocal用法讨论请参见Exploiting ThreadLocaltoenhancescalability

    youdao

  • By using ThreadLocal, we can reduce contention by giving each thread its own copy of certain critical objects.

    通过使用ThreadLocal给予每个线程自己的特定临界对象副本我们就可以减少用。

    youdao

  • For example, I could have used a singleton with lower-level mechanisms like a ThreadLocal holding a stack of statistics and context.

    例如可以带有更底层机制的单体(例如ThreadLocal)持有统计值上下文

    youdao

  • One way of getting around this problem is to create a custom SubjectHolder class that wraps a static ThreadLocal to store the current Subject.

    种解决这个问题的方法创建自定义subjectholder它包装了一个staticThreadLocal存储当前Subject。

    youdao

  • You can use ThreadLocal variables to store any sort of per-request context information using the per-thread-singleton technique described earlier.

    可以通过前面讲述的每线程单子技术ThreadLocal变量存储各种每请求(per - request)上下文信息

    youdao

  • The next-fastest data structure is HashMap, followed by ThreadLocal (essentially, a specialized hash table in which the current thread is the key).

    更慢一点儿的数据结构HashMap然后是ThreadLocal(这基本上是一个当前线程作为键特殊列表)。

    youdao

  • By using a ThreadLocal in our Singleton, as shown in Listing 3, we can allow any class in our program to easily acquire a reference to a per-thread Connection.

    如清单3通过使用“单子”中的ThreadLocal我们就能我们程序中的任何容易获取每线程Connection的一个引用

    youdao

  • In JDK 1.2, ThreadLocal was implemented in a manner very similar to Listing 2, except that a synchronized WeakHashMap was used to store the values instead of a HashMap.

    JD k 1.2中,ThreadLocal实现方式清单2中的方式非常相似除了同步weakhashmap代替hashmap存储values之外。

    youdao

  • Other applications for ThreadLocal in which pooling would not be a useful alternative include storing or accumulating per-thread context information for later retrieval.

    其它适合使用ThreadLocal但用池却不能成为好的替代技术应用程序包括存储累积线程上下文信息以备稍后检索之用这样的应用程序。

    youdao

  • ThreadLocal variables are different from normal variables in that each thread has its own individually initialized instance of the variable, which it accesses via get() or set() methods.

    ThreadLocal变量常规变量不同处在于每个线程都有各自初始化变量实例通过get()set()方法予以评估。

    youdao

  • It isn't a particularly good implementation (although it is quite similar to the initial implementation), as it would likely perform poorly, but it illustrates clearly how ThreadLocal behaves.

    不是一个特别好的实现(虽然最初实现非常相似),所以可能性能不佳清楚地说明了ThreadLocal的工作方式。

    youdao

  • Using ThreadLocal allows us to bypass the complexity of determining when to synchronize in order to achieve thread-safety, and it improves scalability because it doesn't require any synchronization.

    使用ThreadLocal使我们可以绕过实现线程安全而对何时需要同步进行判断复杂过程而且因为需要任何同步,所以也改善了可伸缩性

    youdao

  • Instead, the thread class was modified to support ThreadLocal by adding an instance variable to thread that holds a HashMap mapping thread-local variables to their values for the current thread.

    相反地人们通过Thread添加一个实例变量(该变量用于保存当前线程的从线程局部变量它的映射HashMap)来修改thread支持ThreadLocal

    youdao

  • Instead, the thread class was modified to support ThreadLocal by adding an instance variable to thread that holds a HashMap mapping thread-local variables to their values for the current thread.

    相反地人们通过Thread添加一个实例变量(该变量用于保存当前线程的从线程局部变量它的映射HashMap)来修改thread支持ThreadLocal

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定