很轻量但是并不是线程安全的。
它线程安全,而且更节省资源。
清单3说明如何使用此线程安全版本。
为数据存储库使用线程安全的包装器。
(不可变类的一个优点就是它们是线程安全的)。
One advantage of immutable classes is that they are thread-safe.
因此ibinder方法必须实现为线程安全的。
IBinder methods must, therefore, be implemented to be thread-safe.
放到会话中的对象应该是线程安全的和可序列化的。
Objects that you put on the session should be thread-safe and serializable.
使一个类线程安全需要在实现和测试该类时非常小心。
Making a class thread safe requires additional care during the implementation and testing of the class.
清单1显示了一个非线程安全的数值范围类。
此外,Andoid的UI组件包并不是线程安全的。
对象池需要跟踪每个对象的状态,而且应该是线程安全的。
The object pool needs to keep track of the state of each object and to be thread safe.
所有只读的树操作都是线程安全的,只要没有线程修改它。
Any read-only tree operation is thread-safe as long as there isn't any thread modifying it.
尽管我们常用线程安全描述代码,但实际上它是描述数据的。
While thread-safety is a term we typically use to describe code, in actuality it is about data.
一般而言,在保证线程安全的前提下要尽可能地简化同步语句。
In general, strive to make your synchronized blocks as lean as possible, without harming thread safety.
举例来说,考虑一下线程安全的StringBuffer的用法。
第一个条件的限制使volatile变量不能用作线程安全计数器。
The first condition disqualifies volatile variables from being used as thread-safe counters.
具体来说,线程安全是指适当地协调对被多个线程访问的可变数据的访问。
Specifically, thread safety is about properly coordinating access to mutable data that is accessed by multiple threads.
因为这些方法可能会从很多线程同时调用,它们也必须实现为线程安全的。
Because these methods might be called from any number of threads at the same time, they too must be implemented to be thread-safe.
在本文中,您将学习如何构建线程安全的数据存储库来自动保存表单数据。
In this article, you'll learn how to build a thread-safe data repository for keeping auto-saved form data.
从MVM的角度来看,我们不需要关注线程安全,但是需要考虑VM通讯。
On MVM side, we don't need to care about thread-safety, but VM communications.
管理非线程安全类的使用比试图使类成为线程安全的要更容易些。
It may be easier to manage the use of a non-thread-safe class than to try and make the class thread-safe.
批处理应用程序开发人员可以编写线程安全的、且在单个线程中执行的代码。
Batch application developers write code that is thread-safe and executes on a single thread.
您还应该记得,在方法调用之间保留状态的静态类在默认情况下应该是线程安全的。
You should also remember that static classes that preserve state between method calls should be made thread safe by default.
Swing组件必须在EDT中进行访问,除非您调用文档化为线程安全的方法。
Swing components must be accessed in the EDT, unless you call methods documented as thread-safe.
在此实例中,我并没有针对其他与此模式相关的问题,如保持同步以确保线程安全。
In this example, I don't focus on other issues related to this pattern, such as synchronization to make it thread safe.
它最简单的使用模式便是作为一个线程安全的队列,并且在队列为空时阻塞消费者。
In its simplest mode it ACTS as a thread-safe queue in which consumers are blocked while the queue is empty.
您可能偶尔会思考是否要同步化这个方法调用,还是只同步化该方法的线程安全子集。
You may have occasionally pondered whether to synchronize an entire method call or only the thread-safe subset of that method.
可以考虑使用一个线程安全容器类—一个保证用户操作线程安全的数据结构。
Consider a thread-safe container class - a data structure that guarantees thread safety to its clients.
在某些场合,方法可能会从不止一个线程中被调用,因此这些方法必须是写成线程安全的。
In some situations, the methods you implement might be called from more than one thread, and therefore must be written to be thread-safe.
在某些场合,方法可能会从不止一个线程中被调用,因此这些方法必须是写成线程安全的。
In some situations, the methods you implement might be called from more than one thread, and therefore must be written to be thread-safe.
应用推荐