• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

littlesuccess

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

Java并发编程实践-第十三章-Explicit Locks

Explicit Locks

Explicit Lock

Before Java 5.0, the only mechanisms for coordinating access to shared data were synchronized and volatile. Java 5.0 adds another option: ReentrantLock.Contrary to what some have written, ReentrantLock is not a replacement for intrinsic locking, but rather an alternative with advanced features for when intrinsic locking proves too limited.

在Jav 5.0之前的版本中,协调共享数据的访问只能通过synchronized和volatile。在Java 5.0中,我们多了另一个选择:ReentrantLock.有些人认为ReentrantLock是为了取代内置的锁机制,但事实并非如此--ReentrantLock提供了在内置锁机制限制过多的情况下的一种替代方案。

13.1 Lock And ReentrantLock

13.1 Lock与ReentrantLock

posted on 2011-10-17 14:21  littlesuccess  阅读(222)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3