In the example, why not have StateInternalsStateCleaner and
TimeInternalsCleanupTimer
depend on the context to get the current internals instead?


On Thu, Apr 6, 2017 at 8:37 AM, JingsongLee <[email protected]> wrote:

> There is no suitable way to get the CurrentKey.
>  I think using StepContext.timerInternals() and StepContext.stateInternals()
> is better.
> best,
> JingsongLee
> ------------------------------------------------------------------From:Thomas
> Weise <[email protected]>Time:2017 Apr 6 (Thu) 12:45To:dev <
> [email protected]>Subject:StatefulDoFnRunner
> Hi,
>
> While working on the support for splittable DoFn, I see a few cases where
> the DoFn runner classes slightly complicate reuse across elements (or make
> it a bit awkward to implement for the runner).
>
> StateInternalsStateCleaner and TimeInternalsCleanupTimer take xxxInternals
> instances. But since those are key specific, the runner writer has to
> perform acrobatics to flip the key on these internal instances on a per
> element basis (to avoid having to recreate the other objects that refer to
> them).
>
> Would it be possible to instead use the factory and retrieve the internals
> by key? The runner then has the choice to optimize as
> needed. In general, I
> think it would be nice if the processing context related classes are
> designed so that they promote reuse of object instances
> across elements and
> bundles and minimize object creation on a per key basis?
>
> Thanks,
> Thomas
>
>

Reply via email to