Skip to content

Commit

Permalink
Change executeWithRetry signature to accept ODatabaseSession
Browse files Browse the repository at this point in the history
  • Loading branch information
luigidellaquila committed Aug 1, 2017
1 parent f584f6b commit 616b42d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ default OResultSet execute(String language, String script, Map<String, ?> args)
* @throws IllegalArgumentException if nRetries is <= 0 * @throws IllegalArgumentException if nRetries is <= 0
* @throws UnsupportedOperationException if this type of database does not support automatic commit/retry * @throws UnsupportedOperationException if this type of database does not support automatic commit/retry
*/ */
default <T> T executeWithRetry(int nRetries, Function<ODatabase, T> function) default <T> T executeWithRetry(int nRetries, Function<ODatabaseSession, T> function)
throws IllegalStateException, IllegalArgumentException, ONeedRetryException, UnsupportedOperationException { throws IllegalStateException, IllegalArgumentException, ONeedRetryException, UnsupportedOperationException {
if (nRetries < 1) { if (nRetries < 1) {
throw new IllegalArgumentException("invalid number of retries: " + nRetries); throw new IllegalArgumentException("invalid number of retries: " + nRetries);
Expand All @@ -1162,7 +1162,7 @@ default <T> T executeWithRetry(int nRetries, Function<ODatabase, T> function)


for (int i = 0; i < nRetries; i++) { for (int i = 0; i < nRetries; i++) {
try { try {
result = function.apply(this); result = function.apply((ODatabaseSession) this);
commit(); commit();
break; break;
} catch (ONeedRetryException e) { } catch (ONeedRetryException e) {
Expand Down

0 comments on commit 616b42d

Please sign in to comment.