In my application, I've 2 normal verticles and 4 worker verticles. All of them extend the AbstractVerticle. And the application is deployed as a fat jar which uses "io.vertx.core.Starter" to deploy the main verticle, which then in turn deploys the other verticles reading their respective configuration from the disk.
delay is 20 seconds and the Long polling interval is 10 seconds so it should not be blocked for more than 60 seconds ideally, which is the default maximum time a worker thread is allowed to be blocked. But somehow its taking more time and I'm still getting many exceptions of the following format:
Aug 05, 2015 3:19:50 PM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-4,5,main] has been blocked for 128389 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
at com.sun.org.apache.xerces.internal.util.SymbolTable.<init>(SymbolTable.java:79)
at com.sun.org.apache.xerces.internal.util.SymbolTable.<init>(SymbolTable.java:73)
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.<init>(XMLStreamReaderImpl.java:91)
at com.sun.xml.internal.stream.XMLInputFactoryImpl.getXMLStreamReaderImpl(XMLInputFactoryImpl.java:277)
at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:129)
at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLEventReader(XMLInputFactoryImpl.java:78)
at com.amazonaws.http.StaxResponseHandler.handle(StaxResponseHandler.java:89)
at com.amazonaws.http.StaxResponseHandler.handle(StaxResponseHandler.java:42)
at com.amazonaws.http.AmazonHttpClient.handleResponse(AmazonHttpClient.java:1050)
at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:724)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:467)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:302)
at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2419)
at com.amazonaws.services.sqs.AmazonSQSClient.receiveMessage(AmazonSQSClient.java:1130)
at com.example.abc.notif.verticles.workers.PostProcessingVerticle.lambda$start$22(PostProcessingVerticle.java:48)
at com.example.abc.notif.verticles.workers.PostProcessingVerticle$$Lambda$34/1619894293.handle(Unknown Source)
at io.vertx.core.impl.VertxImpl$InternalTimerHandler.handle(VertxImpl.java:711)
at io.vertx.core.impl.VertxImpl$InternalTimerHandler.handle(VertxImpl.java:682)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$15(ContextImpl.java:314)
at io.vertx.core.impl.ContextImpl$$Lambda$7/667447085.run(Unknown Source)
at io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$161(OrderedExecutorFactory.java:91)
at io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor$$Lambda$2/1259769769.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Solution : To increase the Max Worker Execute Time from 60 seconds to lets say 130 seconds
BUT But but... This option is available on VertxOptions [1] which is when you create a Vertx Instance and cannot be used at the Verticle level ( like in DeploymentOptions or something like that )
The problem now comes is that as I'm extending AbstractVerticle which gives me the inherited vertx instance by default, when a Verticle is instantiated, so I'm not initializing the Vertx instance on my own and even if I do that in one of the verticles other verticles would be deployed in the default vertx and this verticle would be disconnected from them.
So I need to share the same vertx instance across all the Verticles. Since I'm not aware of the nuisances of classloading etc w.r.t Vertx initialization and instantiation of Verticles, so my questions is How do I share my custom Vertx instance with all the Verticles ?
Please let me know if something is not clear.