迟缓初始化 meaning in English
lazy initialization
Examples
- One of the proposed fixes to the double - checked locking problem was to make the field that holds the lazily initialized instance a volatile field
对双重检查锁定问题提出的一种修复是使包含迟缓初始化的实例的字段为一个volatile字段。 - Instead of double - checked locking , use the initialize - on - demand holder class idiom , which provides lazy initialization , is thread - safe , and is faster and less confusing than double - checked locking
不使用双重检查锁定,而使用initialize - on - demand holder class idiom ,它提供了迟缓初始化,是线程安全的,而且比双重检查锁定更快且没那么混乱: - This idiom derives its thread safety from the fact that operations that are part of class initialization , such as static initializers , are guaranteed to be visible to all threads that use that class , and its lazy initialization from the fact that the inner class is not loaded until some thread references one of its fields or methods
这个idiom由属于类初始化的操作(如静态初始化器)保证对使用这个类的所有线程都是可见的这一事实衍生其线程安全性,内部类直到有线程引用其字段或者方法时才装载这一事实衍生出迟缓初始化。