| | |
| | | /** |
| | | * Cached value from config so they don't have to be retrieved per operation. |
| | | */ |
| | | private int deadlockRetryLimit; |
| | | |
| | | private int subtreeDeleteSizeLimit; |
| | | |
| | |
| | | } |
| | | this.databasePrefix = builder.toString(); |
| | | |
| | | this.deadlockRetryLimit = config.getDeadlockRetryLimit(); |
| | | this.subtreeDeleteSizeLimit = config.getSubtreeDeleteSizeLimit(); |
| | | this.subtreeDeleteBatchSize = config.getSubtreeDeleteBatchSize(); |
| | | |
| | |
| | | { |
| | | // Attempt the operation under a transaction until it fails or completes. |
| | | boolean completed = false; |
| | | int retryRemaining = deadlockRetryLimit; |
| | | while (!completed) |
| | | { |
| | | // Start a transaction. |
| | |
| | | EntryContainer.transactionCommit(txn); |
| | | completed = true; |
| | | } |
| | | catch (DeadlockException deadlockException) |
| | | { |
| | | EntryContainer.transactionAbort(txn); |
| | | if (retryRemaining-- <= 0) |
| | | { |
| | | throw deadlockException; |
| | | } |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, deadlockException); |
| | | } |
| | | } |
| | | catch (DatabaseException databaseException) |
| | | { |
| | | EntryContainer.transactionAbort(txn); |
| | |
| | | { |
| | | EntryContainer.transactionAbort(txn); |
| | | |
| | | Message message = ERR_JEB_UNCHECKED_EXCEPTION.get(); |
| | | String msg = e.getMessage(); |
| | | if (msg == null) |
| | | { |
| | | msg = stackTraceToSingleLineString(e); |
| | | } |
| | | Message message = ERR_JEB_UNCHECKED_EXCEPTION.get(msg); |
| | | throw new JebException(message, e); |
| | | } |
| | | } |
| | |
| | | { |
| | | transactionAbort(txn); |
| | | |
| | | Message message = ERR_JEB_UNCHECKED_EXCEPTION.get(); |
| | | throw new JebException(message, e); |
| | | String msg = e.getMessage(); |
| | | if (msg == null) |
| | | { |
| | | msg = stackTraceToSingleLineString(e); |
| | | } |
| | | Message message = ERR_JEB_UNCHECKED_EXCEPTION.get(msg); |
| | | throw new JebException(message, e); |
| | | } |
| | | } |
| | | else |
| | |
| | | id2entry.setDataConfig(entryDataConfig); |
| | | |
| | | this.config = cfg; |
| | | this.deadlockRetryLimit = config.getDeadlockRetryLimit(); |
| | | this.subtreeDeleteSizeLimit = config.getSubtreeDeleteSizeLimit(); |
| | | this.subtreeDeleteBatchSize = config.getSubtreeDeleteBatchSize(); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, |