From c1aafd5b206ac6236602902492ce0100957e0ae7 Mon Sep 17 00:00:00 2001 From: Robert Kirchner Date: Sat, 14 Sep 2024 12:35:20 -0500 Subject: [PATCH 1/8] add DB level locking for `acquireLock` method of `EmbeddedTasksLockService` - rk --- .../taskslock/EmbeddedTasksLockService.java | 22 +++---------- .../entity/TaskLockEntityRepository.java | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java index afb78ab..fc46d5a 100644 --- a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java +++ b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java @@ -1,5 +1,6 @@ package rjojjr.com.github.taskslock; +import jakarta.transaction.Transactional; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -29,33 +30,20 @@ public EmbeddedTasksLockService(TaskLockEntityRepository taskLockEntityRepositor } @Override + @Transactional public TaskLock acquireLock(String taskName, String contextId, boolean waitForLock) { return acquireLock(taskName, HostUtil.getRemoteHost(), contextId, waitForLock); } @Override + @Transactional public TaskLock acquireLock(String taskName, String hostName, String contextId, boolean waitForLock) { try { log.debug("attempting to acquire lock for task {}, waiting for lock: {} contextId: {}", taskName, waitForLock, contextId); synchronized (dbLock) { - // TODO - Synchronize at this level across module instances(maybe some kind of db table lock?) - var lockedAt = new Date(); - var entity = taskLockEntityRepository.findById(taskName).orElseGet(() -> new TaskLockEntity(taskName, false, hostName, contextId, new Date())); try { - if (!entity.getIsLocked()) { - entity.setIsLocked(true); - entity.setLockedAt(lockedAt); - entity.setIsLockedByHost(hostName); - entity.setContextId(contextId); - taskLockEntityRepository.save(entity); - var taskLock = new TaskLock( - taskName, - contextId, - true, - lockedAt, - () -> releaseLock(taskName) - ); - cacheLock(taskLock); + var taskLock = taskLockEntityRepository.acquireLock(taskName, hostName, contextId, this::releaseLock, this::cacheLock); + if (taskLock != null) { log.debug("acquired lock for task {} contextId: {}", taskName, contextId); return taskLock; } diff --git a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java index 6140e52..f4ba877 100644 --- a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java +++ b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java @@ -1,10 +1,42 @@ package rjojjr.com.github.taskslock.entity; +import jakarta.persistence.LockModeType; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.exception.DataException; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Lock; import org.springframework.stereotype.Repository; +import rjojjr.com.github.taskslock.models.TaskLock; + +import java.util.Date; +import java.util.function.Consumer; +import java.util.function.Supplier; @ConditionalOnProperty(name = "tasks-lock.client.enabled", havingValue = "false", matchIfMissing = true) @Repository public interface TaskLockEntityRepository extends JpaRepository { + + @Lock(LockModeType.OPTIMISTIC) + default TaskLock acquireLock(String taskName, String hostName, String contextId, Consumer releaseLock, Consumer cacheLock){ + var lockedAt = new Date(); + var entity = findById(taskName).orElseGet(() -> new TaskLockEntity(taskName, false, hostName, contextId, new Date())); + if (!entity.getIsLocked()) { + entity.setIsLocked(true); + entity.setLockedAt(lockedAt); + entity.setIsLockedByHost(hostName); + entity.setContextId(contextId); + save(entity); + var taskLock = new TaskLock( + taskName, + contextId, + true, + lockedAt, + () -> releaseLock.accept(taskName) + ); + cacheLock.accept(taskLock); + return taskLock; + } + return null; + } } From a40f4a5e3632c731e008ac3f81aac4e3f6aac3ed Mon Sep 17 00:00:00 2001 From: Robert Kirchner Date: Sat, 14 Sep 2024 12:48:32 -0500 Subject: [PATCH 2/8] refactor & document DB level locking for `acquireLock` method of `EmbeddedTasksLockService` - rk --- .../taskslock/EmbeddedTasksLockService.java | 4 ++-- .../entity/TaskLockEntityRepository.java | 22 ++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java index fc46d5a..8b3e7f6 100644 --- a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java +++ b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java @@ -42,8 +42,8 @@ public TaskLock acquireLock(String taskName, String hostName, String contextId, log.debug("attempting to acquire lock for task {}, waiting for lock: {} contextId: {}", taskName, waitForLock, contextId); synchronized (dbLock) { try { - var taskLock = taskLockEntityRepository.acquireLock(taskName, hostName, contextId, this::releaseLock, this::cacheLock); - if (taskLock != null) { + var taskLock = taskLockEntityRepository.tryToAcquireLock(taskName, hostName, contextId, this::releaseLock, this::cacheLock); + if (taskLock.getIsLocked()) { log.debug("acquired lock for task {} contextId: {}", taskName, contextId); return taskLock; } diff --git a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java index f4ba877..8671da3 100644 --- a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java +++ b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java @@ -1,8 +1,6 @@ package rjojjr.com.github.taskslock.entity; import jakarta.persistence.LockModeType; -import lombok.extern.slf4j.Slf4j; -import org.hibernate.exception.DataException; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Lock; @@ -11,14 +9,22 @@ import java.util.Date; import java.util.function.Consumer; -import java.util.function.Supplier; @ConditionalOnProperty(name = "tasks-lock.client.enabled", havingValue = "false", matchIfMissing = true) @Repository public interface TaskLockEntityRepository extends JpaRepository { + /** + * Attempts to acquire lock & locks 'task_locks' table while doing so. + * @param taskName unique task name. + * @param hostName hostname of requesting service/container. + * @param contextId a tracing ID provided by request. + * @param releaseLock Consumer function that releases lock. + * @param cacheLock Consumer function that adds TaskLock object to cache. + * @return resulting TaskLock object. + */ @Lock(LockModeType.OPTIMISTIC) - default TaskLock acquireLock(String taskName, String hostName, String contextId, Consumer releaseLock, Consumer cacheLock){ + default TaskLock tryToAcquireLock(String taskName, String hostName, String contextId, Consumer releaseLock, Consumer cacheLock){ var lockedAt = new Date(); var entity = findById(taskName).orElseGet(() -> new TaskLockEntity(taskName, false, hostName, contextId, new Date())); if (!entity.getIsLocked()) { @@ -37,6 +43,12 @@ default TaskLock acquireLock(String taskName, String hostName, String contextId, cacheLock.accept(taskLock); return taskLock; } - return null; + return new TaskLock( + taskName, + contextId, + false, + lockedAt, + () -> {} + ); } } From 55d086a0e21e808ccc3028964ffb8dbd18b33c58 Mon Sep 17 00:00:00 2001 From: Robert Kirchner Date: Sat, 14 Sep 2024 13:01:52 -0500 Subject: [PATCH 3/8] add `tasks-lock.retry-interval.ms` application property - rk --- .../com/github/taskslock/EmbeddedTasksLockService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java index 8b3e7f6..9d656da 100644 --- a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java +++ b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java @@ -3,6 +3,7 @@ import jakarta.transaction.Transactional; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Service; import rjojjr.com.github.taskslock.entity.TaskLockEntity; @@ -20,7 +21,8 @@ @Slf4j public class EmbeddedTasksLockService extends DestroyableTasksLockService { - private static final long RETRY_INTERVAL = 50; + @Value("${tasks-lock.retry-interval.ms:50}") + private long retryInterval; private final TaskLockEntityRepository taskLockEntityRepository; @@ -53,8 +55,8 @@ public TaskLock acquireLock(String taskName, String hostName, String contextId, } if (waitForLock) { - log.debug("task lock not acquired for task {}, retrying in {}ms contextId: {}", taskName, RETRY_INTERVAL, contextId); - ThreadUtil.sleep(RETRY_INTERVAL); + log.debug("task lock not acquired for task {}, retrying in {}ms contextId: {}", taskName, retryInterval, contextId); + ThreadUtil.sleep(retryInterval); return acquireLock(taskName, hostName, contextId, true); } log.debug("did not acquire lock for task {} contextId: {}", taskName, contextId); From 509edf708863f21feac46e98af13ea961ce7490d Mon Sep 17 00:00:00 2001 From: Robert Kirchner Date: Sat, 14 Sep 2024 13:10:48 -0500 Subject: [PATCH 4/8] add DB level locking to `releaseLock` method of `EmbeddedTasksLockService` - rk --- .../taskslock/EmbeddedTasksLockService.java | 14 ++---------- .../entity/TaskLockEntityRepository.java | 22 ++++++++++++++++++- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java index 9d656da..cb3caa4 100644 --- a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java +++ b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java @@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Service; -import rjojjr.com.github.taskslock.entity.TaskLockEntity; import rjojjr.com.github.taskslock.entity.TaskLockEntityRepository; import rjojjr.com.github.taskslock.exception.AcquireLockFailureException; import rjojjr.com.github.taskslock.exception.ReleaseLockFailureException; @@ -14,7 +13,6 @@ import rjojjr.com.github.taskslock.util.HostUtil; import rjojjr.com.github.taskslock.util.ThreadUtil; import org.hibernate.exception.DataException; -import java.util.Date; @ConditionalOnProperty(name = "tasks-lock.client.enabled", havingValue = "false", matchIfMissing = true) @Service @@ -68,21 +66,13 @@ public TaskLock acquireLock(String taskName, String hostName, String contextId, } @Override + @Transactional public String releaseLock(String taskName) { log.debug("attempting to release lock for task {}", taskName); try { String contextId; synchronized (dbLock) { - var entity = taskLockEntityRepository.findById(taskName).orElseGet(() -> new TaskLockEntity(taskName, false, null, null, new Date())); - contextId = entity.getContextId(); - if (entity.getIsLocked()) { - entity.setIsLocked(false); - entity.setLockedAt(null); - entity.setIsLockedByHost(null); - entity.setContextId(null); - - taskLockEntityRepository.save(entity); - } + contextId = taskLockEntityRepository.releaseLock(taskName); } removeLock(taskName, contextId); log.debug("released lock for task {}, contextId: {}", taskName, contextId); diff --git a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java index 8671da3..3ab60a3 100644 --- a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java +++ b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java @@ -16,7 +16,7 @@ public interface TaskLockEntityRepository extends JpaRepository {} ); } + + /** + * Removes lock for task if it exists + * @param taskName unique task identifier + * @return contextId + */ + @Lock(LockModeType.OPTIMISTIC) + default String releaseLock(String taskName){ + var entity = findById(taskName).orElseGet(() -> new TaskLockEntity(taskName, false, null, null, new Date())); + var contextId = entity.getContextId(); + if (entity.getIsLocked()) { + entity.setIsLocked(false); + entity.setLockedAt(null); + entity.setIsLockedByHost(null); + entity.setContextId(null); + + save(entity); + } + return contextId; + } } From fa203cbadf869c810a873bf5a907f1d3e9a6fade Mon Sep 17 00:00:00 2001 From: Robert Kirchner Date: Sat, 14 Sep 2024 15:43:12 -0500 Subject: [PATCH 5/8] fix DB level locking of `EmbeddedTasksLockService` - rk --- .../taskslock/EmbeddedTasksLockService.java | 26 ++++-------- .../EmbeddedTasksLockConfiguration.java | 6 +-- .../entity/TaskLockEntityRepository.java | 7 +++- .../taskslock/entity/TaskLockRepository.java | 40 +++++++++++++++++++ 4 files changed, 55 insertions(+), 24 deletions(-) create mode 100644 src/main/java/rjojjr/com/github/taskslock/entity/TaskLockRepository.java diff --git a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java index cb3caa4..3a4d6af 100644 --- a/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java +++ b/src/main/java/rjojjr/com/github/taskslock/EmbeddedTasksLockService.java @@ -1,18 +1,16 @@ package rjojjr.com.github.taskslock; -import jakarta.transaction.Transactional; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Service; -import rjojjr.com.github.taskslock.entity.TaskLockEntityRepository; +import rjojjr.com.github.taskslock.entity.TaskLockRepository; import rjojjr.com.github.taskslock.exception.AcquireLockFailureException; import rjojjr.com.github.taskslock.exception.ReleaseLockFailureException; import rjojjr.com.github.taskslock.models.TaskLock; import rjojjr.com.github.taskslock.util.HostUtil; import rjojjr.com.github.taskslock.util.ThreadUtil; -import org.hibernate.exception.DataException; @ConditionalOnProperty(name = "tasks-lock.client.enabled", havingValue = "false", matchIfMissing = true) @Service @@ -22,34 +20,25 @@ public class EmbeddedTasksLockService extends DestroyableTasksLockService { @Value("${tasks-lock.retry-interval.ms:50}") private long retryInterval; - private final TaskLockEntityRepository taskLockEntityRepository; + private final TaskLockRepository taskLockRepository; @Autowired - public EmbeddedTasksLockService(TaskLockEntityRepository taskLockEntityRepository) { - this.taskLockEntityRepository = taskLockEntityRepository; + public EmbeddedTasksLockService(TaskLockRepository taskLockRepository) { + this.taskLockRepository = taskLockRepository; } @Override - @Transactional public TaskLock acquireLock(String taskName, String contextId, boolean waitForLock) { return acquireLock(taskName, HostUtil.getRemoteHost(), contextId, waitForLock); } @Override - @Transactional public TaskLock acquireLock(String taskName, String hostName, String contextId, boolean waitForLock) { try { log.debug("attempting to acquire lock for task {}, waiting for lock: {} contextId: {}", taskName, waitForLock, contextId); synchronized (dbLock) { - try { - var taskLock = taskLockEntityRepository.tryToAcquireLock(taskName, hostName, contextId, this::releaseLock, this::cacheLock); - if (taskLock.getIsLocked()) { - log.debug("acquired lock for task {} contextId: {}", taskName, contextId); - return taskLock; - } - } catch (DataException e) { - log.debug("Task lock not acquired for task {} because this worker lost in a race condition", taskName); - } + var taskLock = taskLockRepository.getTaskLock(taskName, hostName, contextId, this::releaseLock, this::cacheLock); + if (taskLock != null) return taskLock; } if (waitForLock) { @@ -66,13 +55,12 @@ public TaskLock acquireLock(String taskName, String hostName, String contextId, } @Override - @Transactional public String releaseLock(String taskName) { log.debug("attempting to release lock for task {}", taskName); try { String contextId; synchronized (dbLock) { - contextId = taskLockEntityRepository.releaseLock(taskName); + contextId = taskLockRepository.releaseLock(taskName); } removeLock(taskName, contextId); log.debug("released lock for task {}, contextId: {}", taskName, contextId); diff --git a/src/main/java/rjojjr/com/github/taskslock/autoconfig/EmbeddedTasksLockConfiguration.java b/src/main/java/rjojjr/com/github/taskslock/autoconfig/EmbeddedTasksLockConfiguration.java index 38e25a7..eff0b84 100644 --- a/src/main/java/rjojjr/com/github/taskslock/autoconfig/EmbeddedTasksLockConfiguration.java +++ b/src/main/java/rjojjr/com/github/taskslock/autoconfig/EmbeddedTasksLockConfiguration.java @@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import rjojjr.com.github.taskslock.EmbeddedTasksLockService; import rjojjr.com.github.taskslock.TasksLockService; -import rjojjr.com.github.taskslock.entity.TaskLockEntityRepository; +import rjojjr.com.github.taskslock.entity.TaskLockRepository; @ConditionalOnProperty(name = "tasks-lock.client.enabled", havingValue = "false", matchIfMissing = true) @Configuration @@ -21,10 +21,10 @@ public class EmbeddedTasksLockConfiguration { @Autowired - private TaskLockEntityRepository taskLockEntityRepository; + private TaskLockRepository taskLockRepository; @Bean public TasksLockService tasksLockService() { - return new EmbeddedTasksLockService(taskLockEntityRepository); + return new EmbeddedTasksLockService(taskLockRepository); } } diff --git a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java index 3ab60a3..9f0f4d0 100644 --- a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java +++ b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockEntityRepository.java @@ -23,9 +23,10 @@ public interface TaskLockEntityRepository extends JpaRepository releaseLock, Consumer cacheLock){ var lockedAt = new Date(); + var entity = findById(taskName).orElseGet(() -> new TaskLockEntity(taskName, false, hostName, contextId, new Date())); if (!entity.getIsLocked()) { entity.setIsLocked(true); @@ -43,6 +44,7 @@ default TaskLock tryToAcquireLock(String taskName, String hostName, String conte cacheLock.accept(taskLock); return taskLock; } + flush(); return new TaskLock( taskName, contextId, @@ -57,7 +59,7 @@ default TaskLock tryToAcquireLock(String taskName, String hostName, String conte * @param taskName unique task identifier * @return contextId */ - @Lock(LockModeType.OPTIMISTIC) + @Lock(LockModeType.PESSIMISTIC_READ) default String releaseLock(String taskName){ var entity = findById(taskName).orElseGet(() -> new TaskLockEntity(taskName, false, null, null, new Date())); var contextId = entity.getContextId(); @@ -69,6 +71,7 @@ default String releaseLock(String taskName){ save(entity); } + flush(); return contextId; } } diff --git a/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockRepository.java b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockRepository.java new file mode 100644 index 0000000..3039644 --- /dev/null +++ b/src/main/java/rjojjr/com/github/taskslock/entity/TaskLockRepository.java @@ -0,0 +1,40 @@ +package rjojjr.com.github.taskslock.entity; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.exception.DataException; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import rjojjr.com.github.taskslock.models.TaskLock; + +import java.util.function.Consumer; + +@Component +@RequiredArgsConstructor +@Slf4j +@ConditionalOnProperty(name = "tasks-lock.client.enabled", havingValue = "false", matchIfMissing = true) +public class TaskLockRepository { + + private final TaskLockEntityRepository taskLockEntityRepository; + + @Transactional + public TaskLock getTaskLock(String taskName, String hostName, String contextId, Consumer releaseLock, Consumer cacheLock) { + try { + var taskLock = taskLockEntityRepository.tryToAcquireLock(taskName, hostName, contextId, releaseLock, cacheLock); + if (taskLock.getIsLocked()) { + log.debug("acquired lock for task {} contextId: {}", taskName, contextId); + return taskLock; + } + } catch (DataException e) { + log.debug("Task lock not acquired for task {} because this worker lost in a race condition", taskName); + } + return null; + } + + @Transactional + public String releaseLock(String taskName) { + return taskLockEntityRepository.releaseLock(taskName); + } +} From 98f6139bebbf2b77cd9da9942be808bc029f5ae3 Mon Sep 17 00:00:00 2001 From: Robert Kirchner Date: Sat, 14 Sep 2024 15:44:36 -0500 Subject: [PATCH 6/8] fix onDestroy method - rk --- .../com/github/taskslock/DestroyableTasksLockService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/rjojjr/com/github/taskslock/DestroyableTasksLockService.java b/src/main/java/rjojjr/com/github/taskslock/DestroyableTasksLockService.java index 3244c86..b8c02f1 100644 --- a/src/main/java/rjojjr/com/github/taskslock/DestroyableTasksLockService.java +++ b/src/main/java/rjojjr/com/github/taskslock/DestroyableTasksLockService.java @@ -1,5 +1,6 @@ package rjojjr.com.github.taskslock; +import jakarta.annotation.PreDestroy; import lombok.extern.slf4j.Slf4j; import rjojjr.com.github.taskslock.exception.TasksLockShutdownFailure; import rjojjr.com.github.taskslock.models.TaskLock; @@ -11,6 +12,7 @@ public DestroyableTasksLockService() { super(); } + @PreDestroy @Override public void onDestroy() { log.info("Shutting down TasksLockService and releasing task-locks"); From f2e49fc06f5470ebaf0d0b97b163503689604521 Mon Sep 17 00:00:00 2001 From: Robert Kirchner Date: Sat, 14 Sep 2024 15:44:56 -0500 Subject: [PATCH 7/8] optimize docker build step - rk --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f11eac..106af39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,7 @@ FROM gradle:7.6.4-jdk17 AS builder COPY . /project WORKDIR /project -RUN echo 'removing build' && (rm -rf build || echo 'no previous build exists') -RUN gradle bootJar +RUN gradle clean bootJar FROM openjdk:17-jdk-slim-bullseye ARG JAR_FILE=/project/build/libs/*.jar From acb938c4ec747540900db7d7f57a5fe8c25528df Mon Sep 17 00:00:00 2001 From: Robert Kirchner Date: Sat, 14 Sep 2024 15:50:06 -0500 Subject: [PATCH 8/8] bump patch - rk --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 77417cf..011eee3 100644 --- a/build.gradle +++ b/build.gradle @@ -6,11 +6,11 @@ plugins { id 'java-library' } -def build = '11' +def build = '14' group = 'rjojjr.com.github' -//version = "1.1.1.$build-SNAPSHOT" -version = "1.1.1-RELEASE" +//version = "1.1.2.$build-SNAPSHOT" +version = "1.1.2-RELEASE" sourceCompatibility = '17'