Reactive Stream Questions
Ben Hale
bhale at pivotal.io
Wed Aug 1 17:21:31 UTC 2018
The difference is that the close is submitted synchronously with submission of the operation. If that rowCountOperation() needed to be lazily calculated, the close comes too early. In the RS world, all of the closures ensure that the close call not only isn't submitted to the queue, but the call isn't even made until it's ready to execute.
-Ben
> On Aug 1, 2018, at 11:24, Douglas Surber <douglas.surber at oracle.com> wrote:
>
> 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.
>
More information about the jdbc-spec-discuss
mailing list