Guys,

first of all I should notice that thre is difference between eception
handling in pessimistic and optimistic transaction, because in
optimistic txs we can't throw CacheException on tx.commit() call.

The second, I'm surprised why TransactionTimeoutException is replaced
by IgniteCheckedException? I still see converter for
IgniteTxTimeoutCheckedException that eventually throws
TransactionTimeoutException with TransactionDeadlockException as
cause.



On Wed, Jun 14, 2017 at 3:11 AM, Dmitriy Setrakyan
<dsetrak...@apache.org> wrote:
> On Tue, Jun 13, 2017 at 5:06 PM, Denis Magda <dma...@apache.org> wrote:
>
>> e.getCause() might return ‘null’ and you’ll get NullPointerException
>> trying to execute e.getCause().getCause().
>>
>> Ideally, we need to throw TransactionDeadlockException like it’s done in
>> .NET.
>>
>
> Agree, looks odd, but because of JSR107 we cannot throw any additional type
> of exception.
>
> Can we simplify by having one getCause() instead of double
> getCause().getCause()?
>
>
>> —
>> Denis
>>
>> > On Jun 13, 2017, at 4:43 PM, Dmitriy Setrakyan <dsetrak...@apache.org>
>> wrote:
>> >
>> > This looks a bit confusing. Why is it not enough to have this check:
>> >
>> > e.getCause().getCause() instanceof TransactionDeadlockException
>> >
>> > ?
>> >
>> > On Tue, Jun 13, 2017 at 4:40 PM, Denis Magda <dma...@apache.org> wrote:
>> >
>> >> Pardon me, copy pasted the catch block twice. This how the block looked
>> >> like in Ignite 1.x
>> >>
>> >> catch (CacheException e) {
>> >>    if (e.getCause() instanceof TransactionTimeoutException &&
>> >>        e.getCause().getCause() instanceof TransactionDeadlockException)
>> >>
>> >>        System.out.println(e.getCause().getCause().getMessage());
>> >> }
>> >>
>> >> and this is how it must be coded in 2.0:
>> >>
>> >>> catch (CacheException e) {
>> >>>   if (e.getCause() instanceof IgniteCheckedException &&
>> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>> >>>
>> >>>       System.out.println(e.getCause().getCause().getMessage());
>> >>> }
>> >>
>> >>
>> >>
>> >> —
>> >> Denis
>> >>
>> >>> On Jun 13, 2017, at 4:24 PM, Denis Magda <dma...@apache.org> wrote:
>> >>>
>> >>> Andrey Gura, Igniters,
>> >>>
>> >>> If to refer to our documentation [1], this is how we need to catch the
>> >> deadlock detection exception:
>> >>>
>> >>> catch (CacheException e) {
>> >>>   if (e.getCause() instanceof IgniteCheckedException &&
>> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>> >>>
>> >>>       System.out.println(e.getCause().getCause().getMessage());
>> >>> }
>> >>>
>> >>> However, this is no longer works in Ignite 2.0 because
>> >> IgniteCheckedException has to be used instead of
>> >> TransactionTimeoutException:
>> >>>
>> >>> catch (CacheException e) {
>> >>>   if (e.getCause() instanceof IgniteCheckedException &&
>> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>> >>>
>> >>>       System.out.println(e.getCause().getCause().getMessage());
>> >>> }
>> >>>
>> >>> See the example with the workaround:
>> >>> https://github.com/dmagda/ignite_transactions/blob/
>> >> master/src/main/java/org/apache/ignite/examples/
>> >> DeadlockDetectionExample.java
>> >>>
>> >>>
>> >>> Could we do on of the following:
>> >>>
>> >>> 1) Recover the previous behavior or
>> >>> 2) Throw TransactionDeadlockDetection right away as it’s done in .NET
>> [3]
>> >>>
>> >>> [1] https://apacheignite.readme.io/docs/transactions#section-
>> >> deadlock-detection
>> >>> [3] https://github.com/apache/ignite/blob/master/modules/
>> >> platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/
>> >> TransactionDeadlockDetectionExample.cs#L110
>> >>>
>> >>
>> >>
>>
>>

Reply via email to