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

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

问题描述

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

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天全站免登陆