| | |
| | | txn.begin(); |
| | | try |
| | | { |
| | | try |
| | | { |
| | | operation.run(this); |
| | | txn.commit(commitPolicy); |
| | | return; |
| | | } |
| | | catch (final StorageRuntimeException e) |
| | | { |
| | | throw unwrap(e); |
| | | } |
| | | } |
| | | catch (final RollbackException e) |
| | | { |
| | | // retry after random sleep (reduces transactions collision. Drawback: increased latency) |
| | |
| | | } |
| | | catch (final StorageRuntimeException e) |
| | | { |
| | | if (e.getCause() != null) |
| | | { |
| | | throw (Exception) e.getCause(); |
| | | } |
| | | throw e; |
| | | throw unwrap(e); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (final StorageRuntimeException e) |
| | | { |
| | | throw unwrap(e); |
| | | } |
| | | } |
| | | |
| | | private Exception unwrap(StorageRuntimeException e) throws Exception |
| | | { |
| | | if (e.getCause() != null) |
| | | { |
| | | throw (Exception) e.getCause(); |
| | | } |
| | | throw e; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean supportsBackupAndRestore() |