Java VertX同步问题-不是从光纤中调用的方法

Java VertX同步问题-不是从光纤中调用的方法,java,synchronization,vert.x,Java,Synchronization,Vert.x,我似乎无法让VertX同步工作。每次我都会遇到“methodnotcalledfromthefiber”异常 在我的眩晕中 public class CVEVerticle extends SyncVerticle { private MongoClient mongo; @Override @Suspendable public void start(Future<Void> fut) { mongo = MongoClient.createShared(vertx,

我似乎无法让VertX同步工作。每次我都会遇到“methodnotcalledfromthefiber”异常

在我的眩晕中

public class CVEVerticle extends SyncVerticle {

private MongoClient mongo;

@Override
@Suspendable
public void start(Future<Void> fut) {
    mongo = MongoClient.createShared(vertx, config());
    Router router = Router.router(vertx);
    router.get("/api/processStats").handler(Sync.fiberHandler(this::processStats));     


    vertx.createHttpServer().requestHandler(router::accept).listen(
        // Retrieve the port from the configuration, default to 8080.
        config().getInteger("http.port", 8084), result -> {
            if (result.succeeded()) {
                fut.complete();
            } else {
                fut.fail(result.cause());
            }
        });
}

@Suspendable
public void processStats(RoutingContext routingContext) {
     // do some stuff
     Sync.awaitResult(h -> process("test", h));
}
公共类CVEVerticle扩展SyncVerticle{
私人MongoClient mongo;
@凌驾
@暂停
公共空间启动(未来未来未来){
mongo=MongoClient.createShared(vertx,config());
路由器=路由器。路由器(vertx);
router.get(“/api/processStats”).handler(Sync.fiberHandler(this::processStats));
createHttpServer().requestHandler(路由器::接受)。侦听(
//从配置中检索端口,默认为8080。
config().getInteger(“http.port”,8084),结果->{
if(result.successed()){
fut.complete();
}否则{
进一步失败(result.cause());
}
});
}
@暂停
公共void processStats(RoutingContext RoutingContext){
//做点什么
同步结果(h->process(“test”,h));
}
pom.xml

    <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-sync</artifactId>
        <version>3.5.0</version>
    </dependency>

io.vertx
垂直同步
3.5.0
不知道为什么它不起作用,我在启动fat jar时在javaagent中传入了quasar core jar。有什么想法吗

干杯
Martin

您还可以在
SyncVerticle.start(Future)
方法中隐藏代码。替代
SyncVerticle.start()


有关详细信息,请参阅。

vertx.createHttpServer()
创建了一个单独的工作线程,因此实际上不会从光纤中调用
fut
。是否可以包含堆栈跟踪?刚刚测试过,没有异常。感谢您的关注,我今天早上发现了我的问题。在processStats方法中,sync.waitResult方法是从mongodb客户端cal中的lambda处理程序调用的l、 此处理程序未被视为fiberhandler,因此它引发了一个异常。好的,很酷。很高兴解决了这个问题。