The AuthorizedCalls bean (shown in Listing 13) provides thread-safe methods for managing the set of authorized calls.
Authorized Callsbean(见清单13)提供了一些线程安全的方法,用于管理这个经过授权的调用的集合。
In some situations, the methods you implement might be called from more than one thread, and therefore must be written to be thread-safe.
在某些场合,方法可能会从不止一个线程中被调用,因此这些方法必须是写成线程安全的。
Because these methods might be called from any number of threads at the same time, they too must be implemented to be thread-safe.
因为这些方法可能会从很多线程同时调用,它们也必须实现为线程安全的。
Note that all the methods, even get(), need to be synchronized for the class to be thread-safe, to ensure that no updates are lost, and that all threads see the most recent value of the counter.
注意所有方法,甚至需要同步get(),使类成为线程安全的类,从而确保没有任何更新信息丢失,所有线程都看到计数器的最新值。
To ensure that your implementation is thread-safe, a class that implements this interface should use either the synchronized keyword on the methods or synchronized blocks within the methods.
为了确保实现是线程安全的,实现该接口的类应该在方法上使用synchronized关键字,或者在方法内部使用同步锁。
IBinder methods must, therefore, be implemented to be thread-safe.
因此ibinder方法必须实现为线程安全的。
The LockPoolMap in Listing 5 exposes thread-safe get and put methods, but spreads the synchronization over a pool of locks, reducing contention substantially.
清单5中的LockPoolMap展示了线程安全的get和put方法,但把同步分散在了锁池中,充分降低了争用可能性。
Swing components must be accessed in the EDT, unless you call methods documented as thread-safe.
Swing组件必须在EDT中进行访问,除非您调用文档化为线程安全的方法。
Swing components must be accessed in the EDT, unless you call methods documented as thread-safe.
Swing组件必须在EDT中进行访问,除非您调用文档化为线程安全的方法。
应用推荐