码迷,mamicode.com
首页 >  
搜索关键字:condition lock await notify    ( 18128个结果
java只使用try和finally不使用catch的原因和场景
JDK并发工具包中,很多异常处理都使用了如下的结构,如AbstractExecutorService,即只有try和finally没有catch。 class X { private final ReentrantLock lock = new ReentrantLock(); // ... public void m() { lock.lock(); ...
分类:编程语言   时间:2014-07-27 11:55:33    阅读次数:275
Javascript 的逻辑运算符的使用技巧和其内在逻辑
Javascript是一个弱类型的语言,也体现在了对表达式的逻辑计算上。对于Java等强类型的语言,进行逻辑判断时,如 if(condition) 中condition所表示的表达式,其结果必须是返回的为true或false的表达式,而javascript 则不然,它可以允许condition是 Number,String,或者Object对象,也可以是undefined 或null的变量,在这方面体现了很大的灵活性。JavaScript引擎会对if(condition) 中condition 的值先进行T...
分类:编程语言   时间:2014-07-27 11:34:22    阅读次数:272
ReentrantLock Condition 实现消费者生产者问题
import java.util.LinkedList;import java.util.Queue;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util....
分类:其他好文   时间:2014-07-27 09:45:42    阅读次数:274
Open the Lock
Problem Description Now an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from 1 to 9. Each time, you can add or minus 1 to any d...
分类:其他好文   时间:2014-07-26 15:24:12    阅读次数:280
【翻译自mos文章】Weblogic AdminServer 启动fail,报错为"unable to get file lock, will retry"
【翻译自mos文章】Weblogic AdminServer 启动fail,报错为"unable to get file lock, will retry"...
分类:Web程序   时间:2014-07-26 15:12:20    阅读次数:237
lock中使用迭代返回yield return是否会释放锁?
项目中遇到一个问题如题,于是做了个小实验,发现在lock中yield return并不会释放该lock,直到整个迭代器完全执行完或者yield break后才会释放lock。 1 class Program 2 { 3 static object mylock = new o...
分类:其他好文   时间:2014-07-26 00:59:56    阅读次数:464
线程同步:何时互斥锁不够,还需要条件变量?
http://www.blogjava.net/fhtdy2004/archive/2009/07/05/285519.html线程同步:何时互斥锁不够,还需要条件变量?很显然,pthread中的条件变量与Java中的wait,notify类似假设有共享的资源sum,与之相关联的mutex 是loc...
分类:编程语言   时间:2014-07-26 00:21:16    阅读次数:249
LVS自动化添加及删除ipvsadm和后端服务器健康状态检测脚本
LVSdirector负载均衡器增加IPVSADM脚本 #vimdirector.sh #!/bin/bash #chkconfig:-8866 #description:thisscripttoaddlvsIP VIP=192.168.0.254 DIP=192.168.0.100 RIP1=192.168.0.101 RIP2=192.168.0.102 PORT=80 SCHELE=wrr LOCKFILE=/var/lock/subsys/ipvsadm case$1in st..
分类:其他好文   时间:2014-07-25 11:36:02    阅读次数:8623
java并发体系结构
并发编程 线程通信 共享内存和消息传递 线程同步 控制不同线程的执行顺序 java并发 基于共享内存模型指令重排序 编译器重排序处理器重排序 cpu重排序写缓存区(cache、寄存器) 内存屏障顺序一致性与Happens-before执行结果有序性 volatile 解决内存可见性问题 锁 lock 显示锁 可中断可定时...
分类:编程语言   时间:2014-07-25 11:24:11    阅读次数:275
HDU - 3530 Subsequence
Description There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum element ...
分类:其他好文   时间:2014-07-25 11:06:41    阅读次数:242
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!