VERTX获取事件循环味觉编号

发布于 2025-02-03 07:54:57 字数 327 浏览 4 评论 0 原文

我正在尝试找到一种方法,以获取事件循环中当前的消息数。

我想放一些日志来知道该消息是否正在加入。

我有这个迭代器,但我认为这是因为 EventExecutor

        Context context = vertx.getOrCreateContext();
        ContextInternal contextInt = (ContextInternal) context;
        EventLoop eventLoop = contextInt.nettyEventLoop();

问候。

I'm trying to find a way to get the current number of message that I have in the event loop.

I want to put some logs to know if the message are getting enqueue.

I have this Iterator, but I dont think it is since are eventExecutor

        Context context = vertx.getOrCreateContext();
        ContextInternal contextInt = (ContextInternal) context;
        EventLoop eventLoop = contextInt.nettyEventLoop();

Regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

囍孤女 2025-02-10 07:54:57

如果将 .nettyeventloop()作为 nioeventloop 施加结果,则可以调用 .pendingTasks 方法,该方法应为您提供有关数字信息的信息事件循环中安排的任务。

NioEventLoop eventLoop = (NioEventLoop) ci.nettyEventLoop();
System.out.println(eventLoop.pendingTasks());

Javadoc关于 NioEventloop 实现:

If you cast the result of .nettyEventLoop() as a NioEventLoop you can invoke the .pendingTasks method that should give you the information about the number of tasks scheduled in the event loop.

NioEventLoop eventLoop = (NioEventLoop) ci.nettyEventLoop();
System.out.println(eventLoop.pendingTasks());

JavaDoc about NioEventLoop implementation:

https://netty.io/4.0/api/io/netty/channel/nio/NioEventLoop.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文