Java Vert.x - 获取结果已经完成:成功错误
Java Vert.x - Getting Result is already complete: succeeded Error
我正尝试在我的顶点代码中执行多个数据库操作,但由于某种原因我收到此错误
Aug 18, 2021 12:20:09 PM io.vertx.core.impl.ContextImpl
SEVERE: Unhandled exception
java.lang.IllegalStateException: Result is already complete: succeeded
at io.vertx.core.impl.FutureImpl.fail(FutureImpl.java:126)
at com.himman.dao.ReturnRawmatToCompanyDAO.lambda(ReturnRawmatToCompanyDAO.java:801)
at io.vertx.core.impl.ContextImpl.lambda$null[=13=](ContextImpl.java:327)
at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
at io.vertx.core.impl.EventLoopContext.lambda$executeAsync[=13=](EventLoopContext.java:38)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
我的代码看起来是这样的。有人可以帮忙吗
public Future<String> delete(String id)
{
Promise<String> deleted = Promise.promise();
delete_1(id).onComplete(handler -> {
delete_2(id).onComplete(handler_1 -> {
delete_3_InvRaw_Mfg(handler_1.result()).onComplete(handler_2 -> {
delete_4_InvRaw_Company(handler_1.result()).onComplete(handler_3 -> {
deleted.complete(id);
});
});
});
});
return deleted.future();
}
您正在尝试完成一个已经完成的 future/Promise。根据您的代码,我怀疑它是 deleted.complete(id);
.
就像@tsegismont 指出的那样,代码似乎比这更完整。
来自doc
Throws: IllegalStateException - when the promise is already completed
我正尝试在我的顶点代码中执行多个数据库操作,但由于某种原因我收到此错误
Aug 18, 2021 12:20:09 PM io.vertx.core.impl.ContextImpl SEVERE: Unhandled exception java.lang.IllegalStateException: Result is already complete: succeeded at io.vertx.core.impl.FutureImpl.fail(FutureImpl.java:126) at com.himman.dao.ReturnRawmatToCompanyDAO.lambda(ReturnRawmatToCompanyDAO.java:801) at io.vertx.core.impl.ContextImpl.lambda$null[=13=](ContextImpl.java:327) at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366) at io.vertx.core.impl.EventLoopContext.lambda$executeAsync[=13=](EventLoopContext.java:38) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
我的代码看起来是这样的。有人可以帮忙吗
public Future<String> delete(String id)
{
Promise<String> deleted = Promise.promise();
delete_1(id).onComplete(handler -> {
delete_2(id).onComplete(handler_1 -> {
delete_3_InvRaw_Mfg(handler_1.result()).onComplete(handler_2 -> {
delete_4_InvRaw_Company(handler_1.result()).onComplete(handler_3 -> {
deleted.complete(id);
});
});
});
});
return deleted.future();
}
您正在尝试完成一个已经完成的 future/Promise。根据您的代码,我怀疑它是 deleted.complete(id);
.
就像@tsegismont 指出的那样,代码似乎比这更完整。
来自doc
Throws: IllegalStateException - when the promise is already completed