本文整理了Java中org.wikibrain.utils.WpThreadUtils.getMaxThreads()
方法的一些代码示例,展示了WpThreadUtils.getMaxThreads()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WpThreadUtils.getMaxThreads()
方法的具体详情如下:
包路径:org.wikibrain.utils.WpThreadUtils
类名称:WpThreadUtils
方法名:getMaxThreads
暂无
代码示例来源:origin: shilad/wikibrain
private static int getMinimumReasonableConnections() {
return 2 * WpThreadUtils.getMaxThreads() + 12;
}
}
代码示例来源:origin: shilad/wikibrain
public int getMaxThreads() {
return WpThreadUtils.getMaxThreads();
}
代码示例来源:origin: org.wikibrainapi/wikibrain-utils
public static <T> void loop(
Collection<T> collection,
final Procedure<T> fn,
final int logModulo) {
loop(collection, WpThreadUtils.getMaxThreads(), new Function<T, Object> () {
public Object call(T arg) throws Exception {
fn.call(arg);
return null;
}
}, logModulo);
}
public static <T,R> List<R> loop(
代码示例来源:origin: org.wikibrainapi/wikibrain-utils
public static <T> void loop(
Collection<T> collection,
final Procedure<T> fn) {
loop(collection, WpThreadUtils.getMaxThreads(), fn, 50);
}
public static <T> void loop(
代码示例来源:origin: shilad/wikibrain
public static <T> void loop(
Collection<T> collection,
final Procedure<T> fn,
final int logModulo) {
loop(collection, WpThreadUtils.getMaxThreads(), new Function<T, Object> () {
public Object call(T arg) throws Exception {
fn.call(arg);
return null;
}
}, logModulo);
}
public static <T,R> List<R> loop(
代码示例来源:origin: shilad/wikibrain
public static <T> void loop(
Collection<T> collection,
final Procedure<T> fn) {
loop(collection, WpThreadUtils.getMaxThreads(), fn, 50);
}
public static <T> void loop(
代码示例来源:origin: org.wikibrainapi/wikibrain-utils
public static <T> void iterate(Iterator<T> iterator, final Procedure<T> fn, int logModulo) {
iterate(iterator, WpThreadUtils.getMaxThreads(), 100, fn, logModulo);
}
代码示例来源:origin: shilad/wikibrain
public static <T,R> List<R> range(int from, int to, final Function<Integer, R> fn) {
return range(from, to, WpThreadUtils.getMaxThreads(), fn);
}
代码示例来源:origin: org.wikibrainapi/wikibrain-utils
public static <T,R> List<R> range(int from, int to, final Function<Integer, R> fn) {
return range(from, to, WpThreadUtils.getMaxThreads(), fn);
}
代码示例来源:origin: shilad/wikibrain
public static <T> void iterate(Iterator<T> iterator, final Procedure<T> fn, int logModulo) {
iterate(iterator, WpThreadUtils.getMaxThreads(), 100, fn, logModulo);
}
代码示例来源:origin: org.wikibrainapi/wikibrain-loader
private void createWorkers() {
workers.clear();
for (int i = 0; i < WpThreadUtils.getMaxThreads(); i++) {
Thread t = new Thread(new Worker());
t.start();
workers.add(t);
}
}
代码示例来源:origin: shilad/wikibrain
private void createWorkers() {
workers.clear();
for (int i = 0; i < WpThreadUtils.getMaxThreads(); i++) {
Thread t = new Thread(new Worker());
t.start();
workers.add(t);
}
}
代码示例来源:origin: shilad/wikibrain
public static synchronized void benchmark() {
long before = System.currentTimeMillis();
microBench();
long after = System.currentTimeMillis();
double secs = (after - before) / 1000.0;
singleCoreSpeed = 0.5 / secs;
int numThreads = WpThreadUtils.getMaxThreads();
before = System.currentTimeMillis();
ParallelForEach.range(0, numThreads, new Procedure<Integer>() {
@Override
public void call(Integer arg) throws Exception {
microBench();
}
});
after = System.currentTimeMillis();
secs = (after - before) / 1000.0 / WpThreadUtils.getMaxThreads();
multiCoreSpeed = 0.5 / secs;
}
代码示例来源:origin: org.wikibrainapi/wikibrain-loader
public static synchronized void benchmark() {
long before = System.currentTimeMillis();
microBench();
long after = System.currentTimeMillis();
double secs = (after - before) / 1000.0;
singleCoreSpeed = 0.5 / secs;
int numThreads = WpThreadUtils.getMaxThreads();
before = System.currentTimeMillis();
ParallelForEach.range(0, numThreads, new Procedure<Integer>() {
@Override
public void call(Integer arg) throws Exception {
microBench();
}
});
after = System.currentTimeMillis();
secs = (after - before) / 1000.0 / WpThreadUtils.getMaxThreads();
multiCoreSpeed = 0.5 / secs;
}
代码示例来源:origin: org.wikibrainapi/wikibrain-utils
public static <T,R> List<R> loop(
Collection<T> collection,
final Function<T,R> fn) {
return loop(collection, WpThreadUtils.getMaxThreads(), fn, 50);
}
public static <T> void loop(
代码示例来源:origin: shilad/wikibrain
public static <T,R> List<R> loop(
Collection<T> collection,
final Function<T,R> fn) {
return loop(collection, WpThreadUtils.getMaxThreads(), fn, 50);
}
public static <T> void loop(
代码示例来源:origin: shilad/wikibrain
public void load() throws DaoException {
totalLinks.set(0);
newLinks.set(0);
interestingLinks.set(0);
ParallelForEach.iterate(
new MySqlDumpParser().parse(sqlDump).iterator(),
WpThreadUtils.getMaxThreads(),
1000,
new Procedure<Object[]>() {
@Override
public void call(Object[] row) throws Exception {
processOneLink(row);
}
},
1000000
);
}
代码示例来源:origin: shilad/wikibrain
public static void range(int from, int to, final Procedure<Integer> fn) {
iterate(new IntRangeIterator(from, to), WpThreadUtils.getMaxThreads(), 10000, fn, Integer.MAX_VALUE);
}
public static <T,R> List<R> range(int from, int to, int numThreads, final Function<Integer, R> fn) {
代码示例来源:origin: org.wikibrainapi/wikibrain-utils
public static void range(int from, int to, final Procedure<Integer> fn) {
iterate(new IntRangeIterator(from, to), WpThreadUtils.getMaxThreads(), 10000, fn, Integer.MAX_VALUE);
}
public static <T,R> List<R> range(int from, int to, int numThreads, final Function<Integer, R> fn) {
代码示例来源:origin: org.wikibrainapi/wikibrain-loader
public void load() throws DaoException {
totalLinks.set(0);
newLinks.set(0);
interestingLinks.set(0);
ParallelForEach.iterate(
new MySqlDumpParser().parse(sqlDump).iterator(),
WpThreadUtils.getMaxThreads(),
1000,
new Procedure<Object[]>() {
@Override
public void call(Object[] row) throws Exception {
processOneLink(row);
}
},
1000000
);
}
内容来源于网络,如有侵权,请联系作者删除!