| 1. | Many common classes are thread - compatible , such as the collection classes 许多常见的类是线程兼容的,如集合类 |
| 2. | Thread - compatible classes are not thread - safe , but can be used safely in concurrent environments by using synchronization appropriately 线程兼容类不是线程安全的,但是可以通过正确使用同步而在并发环境中安全地使用。 |
| 3. | Doing so will enable thread - compatible objects held as instance variables in other thread - safe objects to piggyback on the synchronization of the owning object 这样做会使线程兼容的对象作为变量实例包含在其他线程安全的对象中,从而可以利用其所有者对象的同步。 |
| 4. | Bloch outlines a taxonomy that describes five categories of thread safety : immutable , thread - safe , conditionally thread - safe , thread - compatible , and thread - hostile Bloch给出了描述五类线程安全性的分类方法:不可变、线程安全、有条件线程安全、线程兼容和线程对立。 |
| 5. | Synchronized block . to maximize the usefulness of thread - compatible classes , they should not require that callers synchronize on a specific lock , just that the same lock is used in all invocations 为了最大程度地利用线程兼容类,如果所有调用都使用同一个块,那么就不应该要求调用者对该块同步。 |
| 6. | By documenting that a class is thread - compatible or conditionally thread - safe , you inform users that the class can be used safely by multiple threads through the appropriate use of synchronization 通过将类记录为线程兼容或者有条件线程安全的,您就告知了用户这个类可以通过正确使用同步而安全地在多线程中使用。 |