This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch CAUSEWAY-3745
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 6eb1c5245868a1f11a6a2b7d6fab86a23a2bcffe
Author: Dan Haywood <[email protected]>
AuthorDate: Thu May 23 18:15:44 2024 +0100

    CAUSEWAY-3745: factors out 'suppressFlushing' and 'resumeFlushing' methods
    
    ... more descriptive than setSuppressFlushing(true) or false.
---
 .../integration/repository/RepositoryServiceDefault.java     | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/persistence/commons/src/main/java/org/apache/causeway/persistence/commons/integration/repository/RepositoryServiceDefault.java
 
b/persistence/commons/src/main/java/org/apache/causeway/persistence/commons/integration/repository/RepositoryServiceDefault.java
index cafb081453..3939b0af90 100644
--- 
a/persistence/commons/src/main/java/org/apache/causeway/persistence/commons/integration/repository/RepositoryServiceDefault.java
+++ 
b/persistence/commons/src/main/java/org/apache/causeway/persistence/commons/integration/repository/RepositoryServiceDefault.java
@@ -106,13 +106,21 @@ implements RepositoryService, HasMetaModelContext {
     @Override
     public <T> T execInBulk(Callable<T> callable) {
         try {
-            setSuppressFlush(Boolean.TRUE);
+            suppressFlushing();
             return callable.call();
         } finally {
-            setSuppressFlush(Boolean.FALSE);
+            resumeFlushing();
         }
     }
 
+    private void suppressFlushing() {
+        setSuppressFlush(Boolean.TRUE);
+    }
+
+    private void resumeFlushing() {
+        setSuppressFlush(Boolean.FALSE);
+    }
+
     private void setSuppressFlush(final Boolean suppressFlush) {
         this.suppressFlush.set(suppressFlush);
         if (!suppressFlush) {

Reply via email to