Java??????????н??????????
???????????? ???????[ 2016/3/31 11:26:15 ] ??????????????????? ???????
????Java???????????????????????????????????????wait???????????????????????????? ???????????????????????????????????
????wait????÷???????????????????????
????synchronized (lock) {
????while (/*????*/) {
????try {
????lock.wait();
????} catch (InterruptedException e) {
????e.printStackTrace();
????}
????}
????//???????????????????????
????1). lock.wait()????????????????????????е?????????????????л?????????????
????2). ????ж????????????????while??????if?????????????????????????????????????
????3). notify ?? notifyAll??????notify???????????????????? notifyAll???????????????????????????????????? notify??????????????????????? ????????????????????
????????????????????? notify??notifyAll??????????Щ???????????????????2?????????????????????У??????±????Ч???
???????????? ???????stack?????????size >= 1????????????Щ???stack??????????????е?????
class SaboStack2 {
private final int[] _data;
private int size = 0;
public SaboStack2(int limit) {
_data = new int[limit];
}
private final ReentrantLock lock = new ReentrantLock();
private final Condition lock_empty = lock.newCondition();
private final Condition lock_full = lock.newCondition();
public void push(int v) {
lock.lock();
while (size >= _data.length) {
try {
lock_full.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
_data[size] = v;
++size;
lock_empty.signalAll();
lock.unlock();
}
public int pop() {
int v;
lock.lock();
while (size == 0) {
try {
lock_empty.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
v = _data[size - 1];
--size;
lock_full.signalAll();
lock.unlock();
return v;
}
}
???????????Condition lock????Щ?????????????飬????????????????????????Ч???
???????????Linux????????pthread_cond_wait?????????????????????? ????????????????? ū???????????????????????????????Щ?????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????