title: Vertx executeBlocking use event loop instead of worker thread
body: <p>I come from concept one request = one thread and now i want to undertand the concept of event loop using <code>Vertx</code>. According to docs if we use blocking operation we should pass it to <code>executeBlocking</code> method.</p>
  
  <pre><code>Verticles use the Vert.x worker pool for executing blocking actions, i.e executeBlocking or worker verticle.
  </code></pre>
  
  <p>I have some questions related to this paragraph from <code>http://vertx.io/docs/vertx-core/groovy/</code></p>
  
  <p>This is my code:</p>
  
  <pre><code>public class JdbcVertx extends AbstractVerticle{
      public static void main(String[] args) {
          Vertx v = Vertx.vertx();
          v.deployVerticle(new JdbcVertx(),new DeploymentOptions().setWorkerPoolSize(10));
  
  
      }
      @Override
      public void start() throws Exception {
          JDBCClient client = JDBCClient.createNonShared(this.vertx, new JsonObject()
                                  .put("url", "jdbc:postgresql://localhost:5432/test")
                                  .put("user", "postgres")
                                  .put("password", "pw")
                                  .put("driver_class", "org.postgresql.Driver")
                                  .put("max_pool_size", 30));
  
          this.vertx.createHttpServer()
                  .requestHandler(r -&gt; {
                      int i = (int) (Math.random() * 100);
                      System.out.println("Req id: " + i+ " "+Thread.currentThread().getName());
                      client.getConnection(handler -&gt; {
                          if (handler.failed()) {
                              throw new RuntimeException(handler.cause());
                          } else {
                              final SQLConnection connection = handler.result();
                              this.vertx.executeBlocking(blockingCodeHandler-&gt;{
                              connection.execute(execute(), hndlr -&gt; {
                                  connection.close(closehndlr -&gt; {
                                      if (closehndlr.failed()) {
                                          throw new RuntimeException(closehndlr.cause());
                                      } else {
                                          System.out.println("CON end: "+i+" "+Thread.currentThread().getName());
                                          r.response().putHeader("content-type", "text/html").end("Response: " + i);
                                      }
                                  });
                              });
                              },false,as-&gt;{});
                          }
                      });
                  }).listen(8080);
      }
  
      private String execute(){     
              return "insert into rubbish (name) values ('test')";
  
      }
  </code></pre>
  
  <p>I send 100 requests to http server this is output:</p>
  
  <pre><code>Req id: 45 vert.x-eventloop-thread-0
  Req id: 22 vert.x-eventloop-thread-0
  Req id: 96 vert.x-eventloop-thread-0
  Req id: 85 vert.x-eventloop-thread-0
  Req id: 33 vert.x-eventloop-thread-0
  CON end: 22 vert.x-eventloop-thread-0
  CON end: 33 vert.x-eventloop-thread-0
  CON end: 45 vert.x-eventloop-thread-0
  CON end: 85 vert.x-eventloop-thread-0
  </code></pre>
  
  <p>1) How event loop switched between requests (from output it firstly get some requests and then give them responses)?</p>
  
  <p>2)I use <code>executeBlocking</code> method but how you can see code above use only event loop thread named <code>vert.x-eventloop-thread-0</code></p>
  
  <p>3)According to first question vertx event loop switched between request but if i change method <code>execute</code> to:</p>
  
  <pre><code> private String execute(){ 
          Thread.sleep(3000);
              return "insert into rubbish (name) values ('test')";      
      }
  </code></pre>
  
  <p>It will stop the event loop until time out is not finished</p>
  
  <p>Thank you in advance</p>