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