use of com.jcabi.log.VerboseCallable in project jcabi-github by jcabi.
the class MkGithubTest method canHandleMultipleThreads.
/**
* MkGithub can handle multiple threads in parallel.
* @throws Exception if some problem inside
*/
@Test
public void canHandleMultipleThreads() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final int threads = Tv.HUNDRED;
final ExecutorService svc = Executors.newFixedThreadPool(threads);
final Callable<Void> task = new VerboseCallable<Void>(new Callable<Void>() {
@Override
public Void call() throws Exception {
repo.issues().create("", "");
return null;
}
});
final Collection<Callable<Void>> tasks = new ArrayList<Callable<Void>>(threads);
for (int idx = 0; idx < threads; ++idx) {
tasks.add(task);
}
svc.invokeAll(tasks);
MatcherAssert.assertThat(repo.issues().iterate(new ArrayMap<String, String>()), Matchers.<Issue>iterableWithSize(threads));
}
Aggregations