- Check when renaming file that name doesn't already exist.
[pithos] / src / gr / ebs / gss / server / ejb / TransactionHelper.java
index 8b9c073..51080cb 100644 (file)
@@ -46,12 +46,12 @@ public class TransactionHelper<T> {
         * Number of times to retry a transaction that was rolled back due to
         * optimistic locking.
         */
-       private static final int TRANSACTION_RETRIES = 10;
+       private static final int TRANSACTION_RETRIES = 20;
 
        /**
         * The minimum retry timeout in milliseconds.
         */
-       private static final int MIN_TIMEOUT = 100;
+       private static final int MIN_TIMEOUT = 200;
 
        /**
         * Execute the supplied command until it completes, ignoring transaction
@@ -86,8 +86,13 @@ public class TransactionHelper<T> {
                                Throwable cause = e.getCause();
                                if (!(cause instanceof EJBTransactionRolledbackException) ||
                                                        retry == TRANSACTION_RETRIES - 1) {
+                                       logger.info("Transaction retry #" + (i+1) +
+                                                               " failed due to " + cause);
                                        executor.shutdownNow();
-                                       throw new Exception(cause);
+                                       if (cause instanceof Exception)
+                                               throw (Exception) cause;
+                                       if (cause instanceof Error)
+                                               throw (Error) cause;
                                }
                                delay = MIN_TIMEOUT + (int) (MIN_TIMEOUT * Math.random() * (i + 1));
                                String origCause = cause.getCause() == null ?