Thanks Michael - LGTM On Fri, 5 May 2017 at 12:04 Michal Borowiecki <michal.borowie...@openbet.com> wrote:
> I shall move all alternatives other than the main proposal into the > Rejected Alternatives section and if I hear any objections, I'll move those > back up and we'll discuss further. > > Done. > > > Still looking forward to any comments, especially about the recently > proposed ability to cancel punctuation schedules. I think it goes well in > the spirit of making complex things possible (such as the hybrid semantics). > > > In the absence of further comments I shall call for a vote in the next few > days. > > > Thanks, > > MichaĆ > > On 04/05/17 09:41, Michal Borowiecki wrote: > > Further in this direction I've updated the main proposal to incorporate > the Cancellable return type for ProcessorContext.schedule and the guidance > on how to implement "hybrid" punctuation with the proposed 2 > PunctuationTypes. > > I look forward to more comments whether the Cancallable return type is an > agreeable solution and it's precise definition. > > I shall move all alternatives other than the main proposal into the > Rejected Alternatives section and if I hear any objections, I'll move those > back up and we'll discuss further. > > > Looking forward to all comments and suggestions. > > > Thanks, > > Michal > > On 01/05/17 18:23, Michal Borowiecki wrote: > > Hi all, > > As promised, here is my take at how one could implement the previously > discussed hybrid semantics using the 2 PunctuationType callbacks (one for > STREAM_TIME and one for SYSTEM_TIME). > > However, there's a twist. > > Since currently calling context.schedule() adds a new PunctuationSchedule > and does not overwrite the previous one, a slight change would be required: > > a) either that PuncuationSchedules are cancellable > > b) or that calling schedule() overwrites(cancels) the previous one with > the given PunctuationType (but that's not how it works currently) > > > Below is an example assuming approach a) is implemented by having schedule > return Cancellable instead of void. > ProcessorContext context; > long streamTimeInterval = ...; > long systemTimeUpperBound = ...; //e.g. systemTimeUpperBound = > streamTimeInterval + some tolerance > Cancellable streamTimeSchedule; > Cancellable systemTimeSchedule; > long lastStreamTimePunctation = -1; > > public void init(ProcessorContext context){ > this.context = context; > streamTimeSchedule = context.schedule(PunctuationType.STREAM_TIME, > streamTimeInterval, this::streamTimePunctuate); > systemTimeSchedule = context.schedule(PunctuationType.SYSTEM_TIME, > systemTimeUpperBound, this::systemTimePunctuate); > } > > public void streamTimePunctuate(long streamTime){ > periodicBusiness(streamTime); > > systemTimeSchedule.cancel(); > systemTimeSchedule = context.schedule(PunctuationType.SYSTEM_TIME, > systemTimeUpperBound, this::systemTimePunctuate); > } > > public void systemTimePunctuate(long systemTime){ > periodicBusiness(context.timestamp()); > > streamTimeSchedule.cancel(); > streamTimeSchedule = context.schedule(PunctuationType.STREAM_TIME, > streamTimeInterval, this::streamTimePunctuate); > } > > public void periodicBusiness(long streamTime){ > // guard against streamTime == -1, easy enough. > // if you need system time instead, just use > System.currentTimeMillis() > > // do something businessy here > } > >