- 博客(6)
- 收藏
- 关注
转载 Java - Why wait, notify and notifyAll is defined in Object Class and not on Thread class
Java中的锁是定义在对象(object)上的, wait, notify是与锁相关的操作,因此方法应该定义在对象类里。 在Java中, 为了进入critical section of code ,线程只需要获取锁和等待锁, 它们不需要知道哪个线程在hold锁, 只需要知道锁正在被hold, 它们只需要等待锁释放,而不需要ask hold锁的线程来释放锁。
2015-06-29 17:52:01 366
转载 Java - Why wait notify and notifyAll called from synchronized block or method in Java
http://javarevisited.blogspot.de/2011/05/wait-notify-and-notifyall-in-java.html 简单来说是为了解决潜在的边界条件 (race condition) 问题。 用分步的生产者消费者流程举例来说: 1. The Producer thread tests the condition (buffer is f
2015-06-29 17:11:34 246
转载 Java - How to write Thread-Safe Code in Java
The content comes from here. Becasue I can't open this page without proper proxy, so I copy the content here. 多线程时的concurrency issues 主要有: race condition , deadlock 等。 Here is some points
2015-06-25 16:44:07 310
转载 Java - String vs StringBuffer vs StringBuilder in Java
The content comes from here Because sometimes I can't open the blog page without proper proxy, so I have to copy the content here. String is one of the most important classes in Java and any
2015-06-17 18:48:47 437
转载 Java - Why Enum Singleton are better in Java
http://javarevisited.blogspot.de/2012/07/why-enum-singleton-are-better-in-java.html Because I can't open this page without proper proxy, so I copy the content here. Enum Singletons are new way
2015-06-16 16:14:55 457
转载 Java - Race condition in Java multithreading
http://javarevisited.blogspot.de/2012/02/what-is-race-condition-in.html Because sometimes I can't open this page, so I copy the content here. Race condition in Java is a type of concurrency
2015-06-16 14:24:34 519
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人