首页> 外文期刊>Java Developer's Journal >Concurrent Programming and Locking in J2SE 5.0
【24h】

Concurrent Programming and Locking in J2SE 5.0

机译:J2SE 5.0中的并发编程和锁定

获取原文
获取原文并翻译 | 示例

摘要

In concurrent programming, exclusion refers to any technique that dynamically locks certain blocks of code so multiple threads can't corrupt their shared resources in ways that can cause integrity problems. In Java, exclusion has meant using the synchronized keyword against a method or block of code to control access to an object's lock. Even though synchronization is a simple and concise way of controlling access to critical code, there are some limitations: 1. While a thread is trying to acquire a lock, it can't be interrupted or timed-out. 2. Each lock can only test against a single implicit condition using the wait() and notify() methods, which doesn't give developers much flexibility when trying to react to particular program states.
机译:在并发编程中,排除是指可以动态锁定某些代码块的任何技术,这样,多个线程就不会以可能引起完整性问题的方式破坏其共享资源。在Java中,排除意味着对方法或代码块使用synced关键字来控制对对象锁的访问。即使同步是控制对关键代码的访问的一种简单明了的方法,也存在一些局限性:1.在线程尝试获取锁时,它不能被中断或超时。 2.每个锁只能使用wait()和notify()方法针对单个隐式条件进行测试,这在尝试对特定程序状态做出反应时并没有给开发人员太大的灵活性。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号