import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClient;
public class HttpRequest extends AbstractVerticle {
@Override
public void start() throws Exception {
super.start();
for (int i = 0; i < 1000; i++) {
HttpClient httpClient = vertx.createHttpClient();
httpClient.getNow(80, "localhost", "", response -> {
});
}
}
public static void main(String[] args) {
Vertx vtx = Vertx.vertx();
vtx.deployVerticle(new HttpRequest());
}
}
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/068db03e-ff9a-49c0-bf20-da6f0332cc3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
httpClient.getNow(80, "localhost", "", response -> {
httpClient.close();
});
Exception in thread "globalEventExecutor-1-1" java.lang.InternalError: java.io.FileNotFoundException: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-1.b14.el7_2.x86_64/jre/lib/ext/cldrdata.jar (Too many open files)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1003)
at sun.misc.URLClassPath.getResource(URLClassPath.java:212)
at java.net.URLClassLoader$1.run(URLClassLoader.java:365)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.ResourceBundle$RBClassLoader.loadClass(ResourceBundle.java:503)
at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2640)
at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1501)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1465)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1419)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1361)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:845)
at java.util.logging.Level.computeLocalizedLevelName(Level.java:265)
at java.util.logging.Level.getLocalizedLevelName(Level.java:324)
at java.util.logging.SimpleFormatter.format(SimpleFormatter.java:165)
at java.util.logging.StreamHandler.publish(StreamHandler.java:211)
at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:116)
at java.util.logging.Logger.log(Logger.java:738)
at io.netty.util.internal.logging.JdkLogger.log(JdkLogger.java:606)
at io.netty.util.internal.logging.JdkLogger.warn(JdkLogger.java:482)
at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:235)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/cdb64239-4023-493b-98bd-0f84c66e3e6b%40googlegroups.com.
@Override
public void start() throws Exception {
super.start();
HttpClient httpClient = vertx.createHttpClient();
httpClient.getNow(80, "localhost", "", response -> {
httpClient.close();
});
}
public static void main(String[] args) {
Vertx vtx = Vertx.vertx(new VertxOptions());
for (int i = 0; i < 10000; i++) {
vtx.deployVerticle(HttpRequest.class.getName());
}
}
public class HttpRequest extends AbstractVerticle {
@Override
public void start() throws Exception {
super.start();
HttpClient httpClient = vertx.createHttpClient();
for (int i = 0; i < 1000; i++) {
httpClient.getNow(80, "localhost", "", response -> {
System.out.println(response.statusMessage()+response.statusCode());
});
}
}
public static void main(String[] args) {
Vertx vtx = Vertx.vertx();
vtx.deployVerticle(new HttpRequest());
}
}
In your last example your still deploying the verticle which creates a fresh HTTPClient 5000 times...
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/41150705-76e9-4874-95c9-20ce95bf1a39%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.