vertx newb here.
I have a while loop that asks postgres for notifications. So I created a WorkerVerticle and placed the loop code in the start() method of that WorkerVerticle.
A minute after the application boots vertx throws an exception in the WorkerVerticle saying the thread is blocked.
I thought the WorkerVerticle is just the ticket for known blocking code, so I was surprised that vertx throws the exception.
After re-reading the docs, I'm still not groking why vertx throws the exception, and how I should re-think that loop code.
The top level exception trace:
[vertx-blocked-thread-checker] [user: WARN] WARN
i.v.core.impl.BlockedThreadChecker - Thread
Thread[vert.x-worker-thread-3,5,main] has been blocked for 60798 ms, time limit
is 60000
io.vertx.core.VertxException: Thread blocked
at java.lang.Thread.sleep(Native
Method) ~[na:1.8.0_66]
at
sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source) ~[na:na]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497)
~[na:1.8.0_66]
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
~[groovy-all-2.4.4.jar:2.4.4]
at
groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
~[groovy-all-2.4.4.jar:2.4.4]
at
org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrap.invoke(StaticMetaMethodSite.java:133)
~[groovy-all-2.4.4.jar:2.4.4]
at
org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:91)
~[groovy-all-2.4.4.jar:2.4.4]
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
~[groovy-all-2.4.4.jar:2.4.4]
at blah.ace.PersistanceMonitorVerticle.start(PersistanceMonitorVerticle.groovy:54)
~[main/:na]
at
io.vertx.lang.groovy.GroovyVerticle.start(GroovyVerticle.groovy:64)
~[vertx-lang-groovy-3.2.0.jar:na]