处理键控窗口后如何立即清除状态? [英] How to clear state immediately after a keyed window is processed?

查看:49
本文介绍了处理键控窗口后如何立即清除状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序使用由时间戳记功能键控的键控窗口.这意味着一旦触发并处理了特定的窗口,就没有必要保持该键处于活动状态,因为不可能再次出现该特定的键.由于此用例涉及不断扩展键,因此我想在完成处理后立即清除键的状态,而无需配置计时器.

My application uses a keyed window that is keyed by a function of timestamp. This means once that particular window has been fired and processed, there is no use in keeping that key active because there is no way that particular key will appear again. Because this use case involves continuously expanding keys, I want to clear the state of a key as soon as it is finished processing without having to configure timers.

在完成每个键控窗口的处理之后,是否可以通过 evictor 方法或 apply 方法实现此目的?

Is this something that can be achieved in the evictor method or apply method after each keyed window is done processing?

推荐答案

Windows自动清除其状态.我能想到的唯一情况可能是您是否正在使用挂在窗口上下文对象之外的globalState.但是,一旦窗口触发(或者在事件时间窗口中,一旦允许的延迟过期),就会释放窗口本身及其状态.

Windows clean up their state automatically. The only case I can think of where you might need to be concerned is if you are using the globalState that hangs off the window context object. But the windows themselves, and their state, are freed as soon as the window has fired (or in the case of event time windows, once the allowed lateness has expired).

这篇关于处理键控窗口后如何立即清除状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆