I don't think there's a built in way. One "hacky" way to do it is have a static flag to indicate whether or not the shared instance initialization is complete.
As far as the shared state goes - there's a ticket tracking this issue: SAMZA-402 <https://issues.apache.org/jira/browse/SAMZA-402> . But I don't think there's any ticket for the use case you mention. On Fri, Jan 16, 2015 at 6:25 PM, Tommy Becker <[email protected]> wrote: > We have some collaborator classes that we need access to not only from > task instances but also from custom SerdeFactorys. Unfortunately Samza > doesn't really provide a method to share state, so we've resorted to a > singleton service-locator type class. That solves the problem of sharing > instances but not the problem of where to initialize these instances. I'm > curious if any thought been given to providing job-level lifecycle hooks? > If anyone else has had need to share state within jobs, how did you do it? > > -Tommy > > ________________________________ > > This email and any attachments may contain confidential and privileged > material for the sole use of the intended recipient. Any review, copying, > or distribution of this email (or any attachments) by others is prohibited. > If you are not the intended recipient, please contact the sender > immediately and permanently delete this email and any attachments. No > employee or agent of TiVo Inc. is authorized to conclude any binding > agreement on behalf of TiVo Inc. by email. Binding agreements with TiVo > Inc. may only be made by a signed written agreement. > -- Thanks and regards Chinmay Soman
