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

ahuber pushed a commit to branch v4
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit be5aa346e10a46cc0476f5de1cabf6355cfd64b5
Merge: 18f48dd82e9 2fbe045e96e
Author: Andi Huber <[email protected]>
AuthorDate: Wed Jun 25 22:14:32 2025 +0200

    Merge remote-tracking branch 'origin/main' into v4

 .../services/wrapper/control/AsyncControl.java     | 205 +++++++++++----------
 .../services/wrapper/control/AsyncLogger.java      |  53 ++++++
 .../services/wrapper/control/ControlAbstract.java  |  87 ---------
 .../services/wrapper/control/ExecutionMode.java    |  44 -----
 .../services/wrapper/control/SyncControl.java      | 103 ++++++-----
 .../wrapper/control/AsyncControl_Test.java         |  40 ++--
 .../services/wrapper/control/SyncControl_Test.java |  33 ++--
 .../runtime/wrap/WrapperInvocationHandler.java     |   5 +-
 .../wrapper/WrapperFactoryDefault.java             | 198 ++++++++++----------
 .../handlers/DomainObjectInvocationHandler.java    |  12 +-
 .../wrapper/WrapperFactoryDefaultTest.java         |   4 +-
 .../BackgroundService_IntegTestAbstract.java       |   6 +-
 .../testdomain/interact/CommandArgumentTest.java   |   2 +-
 13 files changed, 366 insertions(+), 426 deletions(-)

diff --cc 
api/applib/src/main/java/org/apache/causeway/applib/services/wrapper/control/AsyncControl.java
index 7b1ed149943,e59fdeef199..567acbcd4a9
--- 
a/api/applib/src/main/java/org/apache/causeway/applib/services/wrapper/control/AsyncControl.java
+++ 
b/api/applib/src/main/java/org/apache/causeway/applib/services/wrapper/control/AsyncControl.java
@@@ -34,9 -36,8 +36,8 @@@ import org.apache.causeway.applib.servi
  import org.apache.causeway.applib.services.wrapper.WrapperFactory;
  import org.apache.causeway.commons.internal.assertions._Assert;
  
- import lombok.Getter;
  import lombok.SneakyThrows;
 -import lombok.extern.log4j.Log4j2;
 +import lombok.extern.slf4j.Slf4j;
  
  /**
   * Modifies the way in which an asynchronous action initiated through the
@@@ -55,8 -54,39 +54,40 @@@
   *
   * @since 2.0 {@index}
   */
 -@Log4j2
++
 +@Slf4j
- public class AsyncControl<R> extends ControlAbstract<AsyncControl<R>> {
+ public record AsyncControl<R>(
+         Class<R> returnType,
+         SyncControl syncControl,
+         @Nullable ExecutorService executorService,
+ 
+         /**
+          * Defaults to the system clock, if not overridden
+          */
+         @Nullable VirtualClock clock,
+         /**
+          * Defaults to the system locale, if not overridden
+          */
+         @Nullable Locale locale,
+         /**
+          * Defaults to the system time zone, if not overridden
+          */
+         @Nullable ZoneId timeZone,
+         /**
+          * Specifies the user for the session used to execute the command
+          * asynchronously, in the background.
+          *
+          * <p>If not specified, then the user of the current foreground 
session is used.
+          */
+         @Nullable UserMemento user,
+         /**
+          * Contains the result of the invocation.
+          *
+          * <p> If an entity is returned, then the object is automatically 
detached
+          * because the persistence session within which it was obtained will 
have
+          * been closed already.
+          */
+         AtomicReference<Future<R>> futureRef) {
  
      /**
       * Factory method to instantiate a control instance for a void action
diff --cc 
api/applib/src/main/java/org/apache/causeway/applib/services/wrapper/control/AsyncLogger.java
index 00000000000,e736f03c591..afbdd3f3240
mode 000000,100644..100644
--- 
a/api/applib/src/main/java/org/apache/causeway/applib/services/wrapper/control/AsyncLogger.java
+++ 
b/api/applib/src/main/java/org/apache/causeway/applib/services/wrapper/control/AsyncLogger.java
@@@ -1,0 -1,55 +1,53 @@@
+ /*
+  *  Licensed to the Apache Software Foundation (ASF) under one
+  *  or more contributor license agreements.  See the NOTICE file
+  *  distributed with this work for additional information
+  *  regarding copyright ownership.  The ASF licenses this file
+  *  to you under the Apache License, Version 2.0 (the
+  *  "License"); you may not use this file except in compliance
+  *  with the License.  You may obtain a copy of the License at
+  *
+  *        http://www.apache.org/licenses/LICENSE-2.0
+  *
+  *  Unless required by applicable law or agreed to in writing,
+  *  software distributed under the License is distributed on an
+  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  *  KIND, either express or implied.  See the License for the
+  *  specific language governing permissions and limitations
+  *  under the License.
+  */
+ package org.apache.causeway.applib.services.wrapper.control;
+ 
+ import java.lang.reflect.Method;
+ 
 -import org.apache.logging.log4j.Logger;
 -
+ import org.apache.causeway.applib.services.bookmark.Bookmark;
+ 
+ /**
+  * used for exception logging
+  */
+ public record AsyncLogger(ExceptionHandler rootExceptionHandler, Method 
method, Bookmark bookmark) implements ExceptionHandler {
+ 
 -    static Logger log = 
org.apache.logging.log4j.LogManager.getLogger(AsyncControl.class);
++    static final org.slf4j.Logger log = 
org.slf4j.LoggerFactory.getLogger(AsyncControl.class);
+ 
+     @Override
+     public Object handle(Exception ex) throws Exception {
+         log(ex);
+         return rootExceptionHandler.handle(ex);
+     }
+ 
+     void log(Exception ex) {
+         var buf = new StringBuilder("Failed to execute ");
+         if(method() != null) {
+             buf.append(" ").append(method().getName()).append(" ");
+             if(bookmark() != null) {
+                 buf.append(" on '")
+                         .append(bookmark().logicalTypeName())
+                         .append(":")
+                         .append(bookmark().identifier())
+                         .append("'");
+             }
+         }
+         log.error(buf.toString(), ex);
+     }
+ 
+ }

Reply via email to