java concurrent synchronization
来源:互联网 发布:知水牌富氢水杯多少钱 编辑:程序博客网 时间:2024/06/05 08:03
synchronized keyword usage in java
We can add keyword "synchronized" at the beginning of function to lock the function when we call this function.
If the function is a non-static member of a class, the lock scope is object-wide
if the function is a static member of a class , the lock scope is class-wide.
example1:for static member
two static functions : test_object, test_static. if one object or class access to the function test_object, other object or class cannot access to the function test_static.
example2:for non-static member
two non-static member functions: the same object cannot call test_object and test_static both.
example3:one non-static member and one static member
if a object call test_object and concurrently it can call test_static. equally if a object call test_static it can also call test_object at the same time.
summary: synchronized keyword can add a lock to a object if the called function is a non-static function, or a class if the called function is static function.
- java concurrent synchronization
- java synchronization
- Java Thread Synchronization
- java concurrent
- Java.concurrent.*
- java concurrent
- java concurrent
- Java Concurrent
- java concurrent
- Java Concurrent
- java concurrent
- java concurrent
- java concurrent
- java concurrent
- Synchronization
- synchronization
- synchronization
- Java线程基础(二):Synchronization
- 区分activity的四种加载模式
- android多分辨力支持 密度与分辨力
- IOCP进阶文4篇
- Levenshtein距离(编辑距离)
- 局域网异机备份
- java concurrent synchronization
- postfix邮件服务器维护
- BCG教程
- WM_CREATE ,WM_NCCREATE,WM_DESTROY,WM_NCDESTROY详解
- Linux设备驱动程序第三版学习(11)- 分配内存
- 好吧,一年一篇~~
- Delphi实用小函数
- RPM 的介绍和应用
- Universal USB Installer 将Linux安装光盘移植到USB上