ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Setrakyan <dsetrak...@apache.org>
Subject Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception
Date Tue, 13 Jun 2017 23:43:49 GMT
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 <dmagda@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 <dmagda@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
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message