Skip to content

Commit 67e90ee

Browse files
jolarsenmrsladek
andauthored
chore: Gjør optimisticlockexception retryable (#859)
Co-authored-by: Michal J. Sladek <mrsladek@users.noreply.github.com>
1 parent 83c062a commit 67e90ee

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<jakarta.jakartaee-bom.version>10.0.0</jakarta.jakartaee-bom.version>
5959
<hibernate-core.version>6.6.13.Final</hibernate-core.version>
6060
<jetty.version>12.0.20</jetty.version>
61-
<flyway.version>11.8.1</flyway.version>
61+
<flyway.version>11.8.0</flyway.version>
6262

6363
<mockito.version>5.17.0</mockito.version>
6464
</properties>

task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/BasicCdiProsessTaskDispatcher.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.LinkedHashSet;
77
import java.util.Set;
88

9+
import jakarta.persistence.OptimisticLockException;
910
import jakarta.persistence.QueryTimeoutException;
1011

1112
import org.hibernate.exception.JDBCConnectionException;
@@ -25,6 +26,7 @@ public class BasicCdiProsessTaskDispatcher implements ProsessTaskDispatcher {
2526
*/
2627
private static final Set<Class<?>> DEFAULT_FEILHÅNDTERING_EXCEPTIONS = Set.of(
2728
JDBCConnectionException.class,
29+
OptimisticLockException.class,
2830
QueryTimeoutException.class,
2931
SQLTransientException.class,
3032
SQLNonTransientConnectionException.class,

task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/TaskManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,14 @@ interface Work<R> {
463463

464464
private static int getSystemPropertyWithLowerBoundry(String key, int defaultValue, int lowerBoundry) {
465465
final var property = Optional.ofNullable(getenv(key.toUpperCase().replace(".", "_")))
466-
.orElse(System.getProperty(key, String.valueOf(defaultValue)));
466+
.orElseGet(() -> System.getProperty(key, String.valueOf(defaultValue)));
467467
final var systemPropertyValue = Integer.parseInt(property);
468468
return Math.max(systemPropertyValue, lowerBoundry);
469469
}
470470

471471
private static long getSystemPropertyWithLowerBoundry(String key, long defaultValue, long lowerBoundry) {
472472
final var property = Optional.ofNullable(getenv(key.toUpperCase().replace(".", "_")))
473-
.orElse(System.getProperty(key, String.valueOf(defaultValue)));
473+
.orElseGet(() -> System.getProperty(key, String.valueOf(defaultValue)));
474474
final var systemPropertyValue = Long.parseLong(property);
475475
return Math.max(systemPropertyValue, lowerBoundry);
476476
}

0 commit comments

Comments
 (0)