package com.lab.de;
import static io.vertx.ext.sync.Sync.awaitResult;
import static io.vertx.ext.sync.Sync.fiberHandler;
import co.paralleluniverse.fibers.Suspendable;
import io.vertx.core.eventbus.Message;
import io.vertx.core.json.JsonObject;
public class myVerticle extends io.vertx.ext.sync.SyncVerticle {
String ADDRESS1 = "myAddress1";
String ADDRESS2 = "myAddress2";
@Override
@Suspendable
public void start() {
listenForMessages();
vertx.setTimer(1000, tid -> {sendInitialMessage(); });
}
private void sendInitialMessage() {
vertx.eventBus().send(ADDRESS1, "myRequest");
}
@Suspendable
private void listenForMessages() {
vertx.eventBus().consumer(ADDRESS1, fiberHandler((Message<JsonObject> msg) -> {
System.out.println("Received Message on " + ADDRESS1);
Message<String> reply = null;
try {
reply = awaitResult(h -> vertx.eventBus().send(ADDRESS2, "myMessageContent",h),10*1000);
} catch(Exception e) {
System.err.println("Did not Receive any reply: " + e.getMessage());
return;
}
System.out.println("received Reply: " + reply.body());
}));
vertx.eventBus().consumer(ADDRESS2, fiberHandler((Message<String> msg) -> {
System.out.println("Received Message on " + ADDRESS2);
msg.reply("myReplyString");
}));
}
}
Jun 30, 2016 9:25:08 AM io.vertx.core.Starter
INFO: Succeeded in deploying verticle
Received Message on myAddress1
WARNING: Uninstrumented methods (marked '**') or call-sites (marked '!!') detected on the call stack:
at co.paralleluniverse.common.util.ExtendedStackTrace.here (ExtendedStackTrace.java:44 bci: 8)
at co.paralleluniverse.fibers.Fiber.checkInstrumentation (Fiber.java:1618 bci: 0)
at co.paralleluniverse.fibers.Fiber.verifySuspend (Fiber.java:1591 bci: 6)
at co.paralleluniverse.fibers.Fiber.verifySuspend (Fiber.java:1586 bci: 3)
at co.paralleluniverse.fibers.Fiber.park (Fiber.java:583 bci: 0)
at co.paralleluniverse.fibers.Fiber.park (Fiber.java:587 bci: 4)
at co.paralleluniverse.fibers.FiberAsync.run(long,java.util.concurrent.TimeUnit) (FiberAsync.java:186 bci: 291)
at io.vertx.ext.sync.Sync.awaitResult(java.util.function.Consumer,long) (Sync.java:74 bci: 154)
at com.lab.de.myVerticle.lambda$1(io.vertx.core.eventbus.Message) (myVerticle.java:34 bci: 36) **
at io.vertx.ext.sync.Sync.lambda$null$19031fba$1 (Sync.java:148 bci: 2) (optimized)
at co.paralleluniverse.strands.SuspendableUtils$VoidSuspendableCallable.run (SuspendableUtils.java:44 bci: 4)
at co.paralleluniverse.strands.SuspendableUtils$VoidSuspendableCallable.run (SuspendableUtils.java:32 bci: 1)
at co.paralleluniverse.fibers.Fiber.run (Fiber.java:1024 bci: 11)
at co.paralleluniverse.fibers.Fiber.run1 (Fiber.java:1019 bci: 1)
Did not Receive any reply: Oops. Forgot to instrument a method. Run your program with -Dco.paralleluniverse.fibers.verifyInstrumentation=true to catch the culprit!
at co.paralleluniverse.common.util.ExtendedStackTrace.here (ExtendedStackTrace.java:44bci: 8)
at co.paralleluniverse.fibers.Fiber.checkInstrumentation (Fiber.java:1618 bci: 0)
at co.paralleluniverse.fibers.Fiber.verifySuspend (Fiber.java:1591 bci: 6)
at co.paralleluniverse.fibers.Fiber.verifySuspend (Fiber.java:1586 bci: 3)
at co.paralleluniverse.fibers.Fiber.park (Fiber.java:583 bci: 0)
at co.paralleluniverse.fibers.Fiber.park (Fiber.java:587 bci: 4)
at co.paralleluniverse.fibers.FiberAsync.run(long,java.util.concurrent.TimeUnit)(FiberAsync.java:186 bci: 291)
at io.vertx.ext.sync.Sync.awaitResult(java.util.function.Consumer,long) (Sync.java:74 bci:154)
at com.lab.de.myVerticle.lambda$1(io.vertx.core.eventbus.Message) (myVerticle.java:34 bci:36) **
at io.vertx.ext.sync.Sync.lambda$null$19031fba$1 (Sync.java:148 bci: 2) (optimized)
at co.paralleluniverse.strands.SuspendableUtils$VoidSuspendableCallable.run (SuspendableUtils.java:44 bci: 4)
at co.paralleluniverse.strands.SuspendableUtils$VoidSuspendableCallable.run (SuspendableUtils.java:32 bci: 1)
at co.paralleluniverse.fibers.Fiber.run (Fiber.java:1024 bci: 11)
at co.paralleluniverse.fibers.Fiber.run1 (Fiber.java:1019 bci: 1)
Did not Receive any reply: Oops. Forgot to instrument a method. Run your program with -Dco.paralleluniverse.fibers.verifyInstrumentation=true to catch the culprit!
What i get from this is that line 34 (which is the call to awaitResult) from the method listenForMessages is not instrumented, right?
And this is what puzzles me. It is called from a fiberHandler (which - according to the API - claims to be @Instrumented and @Suspendable).
So, what did i wrong? Don't i use fiberHandlers the right way?
Best,
Philip
--
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/0177463f-4ab3-41ec-948d-dc32d2fda092%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
git clone https://github.com/wette/fiberHandler-example.git
cd fiberHandler-example
mvn package
java -javaagent:quasar-core-0.7.5-jdk8.jar -jar target/myVerticle-0.0.1-SNAPSHOT-fat.jar
$ java -javaagent:quasar-core-0.7.5-jdk8.jar -jar target/myVerticle-0.0.1-SNAPSHOT-fat.jar
Jul 04, 2016 9:06:15 AM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle
Received Message on myAddress1
Did not Receive any reply: Oops. Forgot to instrument a method. Run your program with -Dco.paralleluniverse.fibers.verifyInstrumentation=true to catch the culprit!
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/a233df7f-e75f-48e5-a5bc-13c555c047c6%40googlegroups.com.
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(new MyVerticle());
}
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/7a8b5cf1-5534-4b74-829e-85ba4f86e6ec%40googlegroups.com.
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)quasar-core-0.7.5-jdk8.jar
and i run all of this on Windows 7.
vertx3.3.0
quasar 0.7.5-jdk8
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Mac OS
Did you run it on IDEA?


--
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/cdebbbb4-4513-4f00-97df-c454e4538f57%40googlegroups.com.
<plugin>
<groupId>com.vlkan</groupId>
<artifactId>quasar-maven-plugin</artifactId>
<version>0.7.3</version>
<configuration>
<check>true</check>
<debug>true</debug>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
<dependencies>
<!--
override the internal dependency to use the same quasar version as the one used by vert.x sync, it
works until they change the API.
-->
<dependency>
<groupId>co.paralleluniverse</groupId>
<artifactId>quasar-core</artifactId>
<version>0.7.5</version>
</dependency>
</dependencies>
</plugin>