1、同步代码块尽量小,在保证锁定相关变量的基础上,尽量移出前后代码。
2、不要在同步代码块中写会导致堵塞的方法。
例如InputStream.read()
3、持锁时不要调用其他方法,可以大大降低死锁的概率。
实例
public void methodAAA()
{
synchronized (this) // (1)
{
//…..
}
}1、同步代码块尽量小,在保证锁定相关变量的基础上,尽量移出前后代码。
2、不要在同步代码块中写会导致堵塞的方法。
例如InputStream.read()
3、持锁时不要调用其他方法,可以大大降低死锁的概率。
实例
public void methodAAA()
{
synchronized (this) // (1)
{
//…..
}
}在Linux
Linux
GSOAP是
提升Linu
ECDSA
|
|
|
|
|
|
|
|
|
|