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 <[email protected]> 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
>