public static void main(String[] args) throws Exception {
ExecutorService es = Executors.newFixedThreadPool(300);
Callable<Object> cb = new Callable() {
@Override
public Object call() throws Exception {
Connection conn = Neo4jUtil.getConnection();
Statement statement = conn.createStatement();
TimeUnit.SECONDS.sleep(1);
Neo4jUtil.freeConnection(null, statement, conn);
return null;
}
};
List<Callable<Object>> cl = new ArrayList<>();
for(int j=0;j<=400;j++){
cl.add(cb);
j++;
}
es.invokeAll(cl);
}