i*******6 发帖数: 107 | 1 My 5 cents:
import java.util.concurrent.*;
class MyO implements Runnable{
int index;
CountDownLatch lock;
public MyO (int index, CountDownLatch lock) {
this.index = index;
this.lock = lock;
}
public void run() {
try {
Thread.sleep((long) (Math.random() * 1000));
lock.await();
System.out.println("Take O:" + index + " to form an H2O!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
... 阅读全帖 |
|
i*******6 发帖数: 107 | 2 My 5 cents:
import java.util.concurrent.*;
class MyO implements Runnable{
int index;
CountDownLatch lock;
public MyO (int index, CountDownLatch lock) {
this.index = index;
this.lock = lock;
}
public void run() {
try {
Thread.sleep((long) (Math.random() * 1000));
lock.await();
System.out.println("Take O:" + index + " to form an H2O!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
... 阅读全帖 |
|
w**n 发帖数: 122 | 3 平常用不到,所以基本不会
想速成一下,有什么推荐的东西读读吗?
掌握基本概念就可以(producer/consumer基本懂,但是变形一下就糊涂了//blush )
多谢!! |
|
|
f*******t 发帖数: 7549 | 5 java concurrency in practise |
|
a********n 发帖数: 1287 | 6 pthread document and examples. |
|
A**d 发帖数: 13310 | 7 咱们是同道啊。阁下跟着gay龙萎靡缩了大半个赛季,版面忠诚度0%的最近都hread下边念叨了我好几天,这要不是因为看见今年贵酱油包拿到了这么爽的
赛程眼前出现通往SuperBowl的大道还能是因为啥? |
|
y****e 发帖数: 1012 | 8 在一个机器上写一个jar,用eclipse配置了native library~但是在另外一个机器上却跑
不了……
/usr/lib/jvm/jdk1.7.0/bin/java -Djava.library.path=./lib -Dfile.encoding=UT
F-8 -classpath ./target/classes:./lib/gdata-core-1.0.jar:./lib/gdata-client-
1.0.jar:./lib/gdata-maps-2.0.jar:./lib/gdata-media-1.0.jar:./lib/lpsolve55j.
jar:./target/DCPlacement-jar-with-dependencies.jar:/usr/share/java/log4j-1.2
.jar DatacenterLocator -g 10,10 -l 4000 -s heuristic
报错:
Exception in thread "Thread-3" Exception in thread "Thread-0" Exception in t
h... 阅读全帖 |
|