Re[2]: Reactive Stream Questions
Oleh Dokuka
shadowgun at i.ua
Wed Aug 1 17:25:15 UTC 2018
Oh, now I see, so in that case, the flatMap with the internal try-with-resource would be more than enough.
01.08.2018 20:07, Douglas Surber <douglas.surber at oracle.com>
>All depends on what you mean by “close”. Session.close() is a default method that creates and submits a closeOperation. So execution of Session.close() does not stop the Session from carrying out work or release any resources. The Session is still active until the closeOperation is executed (or Session.abort is called. abort is non-blocking but immediately signals the Session to cease work and release resources.) In terms of the resources actually being freed, the Session is not closed until the closeOperation is executed. On the other hand there’s not much point in doing anything with a Session after calling close except maybe call abort.
>
> So is a Session closed after calling Session.close()? From the user thread’s perspective, yes. From the async perspective, no.
>
>
> > On Aug 1, 2018, at 9:39 AM, Oleh Dokuka <shadowgun at i.ua> wrote:
> >
> > Do you mean that in the mentioned example try-with-resource does not explicitly close the created session, but it will be closed once the rowCountOperation is completed? Is my understanding correct?
> >
> > 01.08.2018 19:24, Douglas Surber <douglas.surber at oracle.com>
> >> Session.close submits a closeOperation. Execution of this operation is async. Try with resources works exactly as desired. The reactive stream alternative is in no way different is this regard from MAIN.
> >>
> >> try (Session s = ds.getSession()) {
> >> s.rowCountOperation(sql).submit();
> >> }
> >>
> >> In this example the user thread submits three Operations without blocking, attachOperation, rowCountOperation, closeOperation. The closeOperation is likely submitted long before the attachOperation is executed, but that is just fine. CloseOperation is every bit as asynchronous as the rowCountOperation.
> >>
> >>> On Aug 1, 2018, at 7:29 AM, Ben Hale <bhale at pivotal.io> wrote:
> >>>
> >>> try/catch, because it happens within the execution flow rather than async, is problematic in an RS environment. Instead, you need to directly execute a close at the appropriate point in the async execution.
-- реклама -----------------------------------------------------------
Самый летний отель юга Украины, бронируй отдых со скидкой
20% при бронировании от 3 ночей -> https://is.gd/S2KM7u
More information about the jdbc-spec-discuss
mailing list