[struts] branch WW-3691-executor updated (8dd76311f -> 8f0db1d22)

2022-10-05 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch WW-3691-executor
in repository https://gitbox.apache.org/repos/asf/struts.git


 discard 8dd76311f WW-3691 Converts BackgroundProcess into interface and uses 
Executor to execute BackgroundProcess
 new 8f0db1d22 WW-3691 Converts BackgroundProcess into interface and uses 
Executor to execute BackgroundProcess

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (8dd76311f)
\
 N -- N -- N   refs/heads/WW-3691-executor (8f0db1d22)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/struts2/interceptor/exec/StrutsBackgroundProcess.java   | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)



[struts] 01/01: WW-3691 Converts BackgroundProcess into interface and uses Executor to execute BackgroundProcess

2022-10-05 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-3691-executor
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 8f0db1d22a5cbfaf43d19628ea548387088f781a
Author: Lukasz Lenart 
AuthorDate: Tue Oct 4 10:12:52 2022 +0200

WW-3691 Converts BackgroundProcess into interface and uses Executor to 
execute BackgroundProcess
---
 .../showcase/wait/ThreadPoolExecutorProvider.java  |  56 +++
 apps/showcase/src/main/resources/struts-wait.xml   |   3 +
 .../interceptor/ExecuteAndWaitInterceptor.java |  66 +---
 .../interceptor/exec/BackgroundProcess.java|  41 +
 .../struts2/interceptor/exec/ExecutorProvider.java |  38 +
 .../StrutsBackgroundProcess.java}  |  80 ++---
 .../interceptor/exec/StrutsExecutorProvider.java   |  53 ++
 .../struts2/interceptor/BackgroundProcessTest.java | 104 
 .../interceptor/ExecuteAndWaitInterceptorTest.java |  46 +-
 .../exec/StrutsBackgroundProcessTest.java  | 179 +
 10 files changed, 513 insertions(+), 153 deletions(-)

diff --git 
a/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/ThreadPoolExecutorProvider.java
 
b/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/ThreadPoolExecutorProvider.java
new file mode 100644
index 0..c7a1d
--- /dev/null
+++ 
b/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/ThreadPoolExecutorProvider.java
@@ -0,0 +1,56 @@
+/*
+ * 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.struts2.showcase.wait;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.struts2.interceptor.exec.ExecutorProvider;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public class ThreadPoolExecutorProvider implements ExecutorProvider {
+
+private static final Logger LOG = 
LogManager.getLogger(ThreadPoolExecutorProvider.class);
+
+private final ExecutorService executor;
+
+public ThreadPoolExecutorProvider() {
+this.executor = new ThreadPoolExecutor(1, 2, 0L, 
TimeUnit.MILLISECONDS, new LinkedBlockingDeque<>());
+}
+
+@Override
+public void execute(Runnable task) {
+LOG.info("Executing task: {}", task);
+executor.execute(task);
+}
+
+@Override
+public boolean isShutdown() {
+return executor.isShutdown();
+}
+
+@Override
+public void shutdown() {
+LOG.info("Shutting down executor");
+executor.shutdown();
+}
+}
diff --git a/apps/showcase/src/main/resources/struts-wait.xml 
b/apps/showcase/src/main/resources/struts-wait.xml
index 8ede40d74..7b6a204a6 100644
--- a/apps/showcase/src/main/resources/struts-wait.xml
+++ b/apps/showcase/src/main/resources/struts-wait.xml
@@ -24,6 +24,9 @@
"https://struts.apache.org/dtds/struts-2.5.dtd";>
 
 
+
+
+
 
 
 
diff --git 
a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
 
b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
index b49ebcae7..4a5cb91b4 100644
--- 
a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
+++ 
b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
@@ -22,12 +22,17 @@ import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.exec.BackgroundProcess;
+import org.apache.struts2.interceptor.exec.ExecutorProvider;
+import org.apache.struts2.interceptor.exec.StrutsBackgroundProcess;
+import

[struts] branch master updated: WW-5238 Uses proper order of mapping functions to support action: prefix

2022-10-05 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/master by this push:
 new a21bd994e WW-5238 Uses proper order of mapping functions to support 
action: prefix
a21bd994e is described below

commit a21bd994eb56bf734f25e4a4590833a3258aa1b8
Author: Lukasz Lenart 
AuthorDate: Thu Oct 6 08:54:14 2022 +0200

WW-5238 Uses proper order of mapping functions to support action: prefix
---
 .../xwork2/config/entities/PackageConfig.java  |  14 +--
 .../dispatcher/mapper/DefaultActionMapper.java |   2 +-
 .../dispatcher/mapper/DefaultActionMapperTest.java | 115 +
 3 files changed, 50 insertions(+), 81 deletions(-)

diff --git 
a/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java 
b/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
index 4d16ee81f..9174e651b 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
@@ -20,26 +20,18 @@ package com.opensymphony.xwork2.config.entities;
 
 import com.opensymphony.xwork2.util.location.Located;
 import com.opensymphony.xwork2.util.location.Location;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 
 import java.io.Serializable;
 import java.util.*;
 
-
 /**
  * Configuration for Package.
  *
  * 
  * In the xml configuration file this is defined as the package 
tag.
  * 
- *
- * @author Rainer Hermanns
- * @version $Revision$
  */
-public class PackageConfig extends Located implements Comparable, 
Serializable, InterceptorLocator {
-
-private static final Logger LOG = 
LogManager.getLogger(PackageConfig.class);
+public class PackageConfig extends Located implements 
Comparable, Serializable, InterceptorLocator {
 
 protected Map actionConfigs;
 protected Map globalResultConfigs;
@@ -422,8 +414,7 @@ public class PackageConfig extends Located implements 
Comparable, Serializable,
 return "PackageConfig: [" + name + "] for namespace [" + namespace + 
"] with parents [" + parents + "]";
 }
 
-public int compareTo(Object o) {
-PackageConfig other = (PackageConfig) o;
+public int compareTo(PackageConfig other) {
 String full = namespace + "!" + name;
 String otherFull = other.namespace + "!" + other.name;
 
@@ -443,7 +434,6 @@ public class PackageConfig extends Located implements 
Comparable, Serializable,
 public static class Builder implements InterceptorLocator {
 
 protected PackageConfig target;
-private boolean strictDMI = true;
 
 public Builder(String name) {
 target = new PackageConfig(name);
diff --git 
a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
 
b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
index 9c09e187e..98fec5316 100644
--- 
a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
+++ 
b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
@@ -289,8 +289,8 @@ public class DefaultActionMapper implements ActionMapper {
 }
 
 parseNameAndNamespace(uri, mapping, configManager);
-extractMethodName(mapping, configManager);
 handleSpecialParameters(request, mapping);
+extractMethodName(mapping, configManager);
 return parseActionName(mapping);
 }
 
diff --git 
a/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
 
b/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
index 479494b16..a9d01eec7 100644
--- 
a/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
+++ 
b/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
@@ -20,15 +20,15 @@ package org.apache.struts2.dispatcher.mapper;
 
 import com.mockobjects.servlet.MockHttpServletRequest;
 import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.Result;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationManager;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.inject.Container;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsInternalTestCase;
-import org.apache.struts2.result.StrutsResultSupport;
 import org.apache.struts2.views.jsp.StrutsMockHttpServletRequest;
 
 import java.util.Arrays;
@@ -38,7 +38,6 @@ import java.util.Map;
 
 /**
  * DefaultActionMapper test