图2展示了乐观锁定背后的思想。
首先,在部署描述符中启用乐观锁定。
First, enable optimistic locking in the deployment descriptor.
然而,表模式也会影响乐观锁定的行为。
However, the schema of the table also affects the behavior of optimistic locking.
乐观锁定的使用能实现更多地同时数据访问。
The use of optimistic locking offers more concurrent access to the data.
乐观锁定特性的局限性和注意事项。
要在应用程序中启用乐观锁定支持,需要执行以下基本步骤
These are a basic steps to be performed in order to enable optimistic locking support in your applications
使用这种编程模型的应用程序将从增强的乐观锁定特性中获益。
Applications using this programming model will benefit from the enhanced optimistic locking feature.
不过,您可以使用乐观锁定技术循环访问一组行并单独更新每个数据行。
However, you can iterate through a set of rows and update each row individually while using optimistic locking techniques.
向要使用乐观锁定的表中添加一个额外的整数列;该列保存修订计数器。
We add an extra integer column to the table for which optimistic locking is required; this holds a revision counter.
我们建议采用乐观锁定策略,将并发控制的责任委派给相应的应用程序逻辑。
Instead, we recommend the use of an optimistic locking strategy, delegating responsibility for concurrency control to appropriate application logic.
另外,还需要一些其他可能的乐观锁定策略和详细设计,以制定合适的并发方案。
There are other possible optimistic locking strategies and detailed design work is needed to devise suitable concurrency schemes.
DB2 V9.5支持进行更简便和快捷的乐观锁定,而且避免了误判的发生。
DB2 9.5 adds support for easier and faster optimistic locking with no false positives.
使用这种编程模型的应用程序可以从增强的乐观锁定特性受益,并且能够进一步增强并发性。
Applications using this programming model benefit from the enhanced optimistic locking feature and gain improved concurrency.
同乐观锁定策略相比,物理数据库锁需要持续较长的时间,因此应用程序性能和吞吐量很可能会受到影响。
As physical database locks are held for a longer time duration than with an optimistic locking strategy, there is more of a chance for performance and throughput being impacted.
如果应用程序访问模式主要是更新数据,那么乐观锁定方法能有利地避免乐观并发性更新的失败。
If the application access pattern is predominately update access, then pessimistic approach might be advantageous in that it avoids optimistic concurrency update failures.
注意,未使用这种编程模型的应用程序被认为是非乐观锁定应用程序,它们将按照以前的方式工作。
Note that applications that do not use this programming model are not considered optimistic locking applications, and they will continue to work as before.
注意,在不进行DDL修改的情况下,乐观锁定应用程序可能会产生更多的漏判(falsenegative)。
Note that without DDL changes, optimistic locking applications may get more false negatives than with DDL changes.
DB2 V9.5 的乐观锁定特性最小化了给定资源对于其他事务的不可用时间,进一步改善了可伸缩性。
Optimistic locking in DB2 9.5 improves scalability by minimizing the time for which a given resource is unavailable for use by other transactions.
避免发生这种情况的方法就是使用乐观锁定策略,即假设在修改某行时,另一个用户试图对这一行进行修改的可能性极低。
A way to avoid this is to follow an optimistic locking strategy and assume that it is very unlikely that another user will try to change the same row that you are changing.
解决这一不必要SQL问题的方法是,采用 “乐观锁定(optimistic locking)”技术。
The solution for this unnecessary SQL problem is to use an "optimistic locking" technique.
下一条语句通知Grails表没有version列(GORM通常会创建一个 version列来优化乐观锁定)。
The next statement tells Grails that the table does not have a version column. (GORM normally creates one to help facilitate optimistic locking.)
由于不需要对表进行DDL修改即可使用针对乐观锁定的新SQL表达式和属性,因此可以轻松地在您的测试应用程序中尝试乐观锁定特性。
Since the new SQL expressions and attributes for optimistic locking can be used with no DDL changes to the tables involved, you can easily try optimistic locking in your test applications.
乐观会话锁定还可用于消息顺序无法保证的事件驱动或基于消息的系统中。
Another use of optimistic session locking is in event driven or message-based systems where message sequence is not guaranteed.
乐观事务锁定通常以其高性能和死锁发生可能性较低的特点而被首选使用。
Optimistic transaction locking is generally preferred for its performance characteristics and reduced likelihood of deadlock situations.
乐观的锁定,只当数据库发生更改时锁定记录。
Optimistic locking, where a record is locked only when changes are committed to the database.
默认条件下,ClearQuest使用乐观的记录锁定。
默认条件下,ClearQuest使用乐观的记录锁定。
应用推荐