Skip to content

Commit

Permalink
LDEV-2824 - modified the behaviour for maxThreads==1
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Mar 18, 2024
1 parent 771bd25 commit cef9ba8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion core/src/main/java/lucee/runtime/functions/closure/Each.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public static String call(PageContext pc, Object obj, UDF udf, boolean parallel,
private static String _call(PageContext pc, Object obj, UDF udf, boolean parallel, int maxThreads, short type) throws PageException {
ExecutorService execute = null;
List<Future<Data<Object>>> futures = null;
if (parallel && maxThreads > 1) {
if (maxThreads < 1) maxThreads = 20;
else if (maxThreads == 1) parallel = false;
if (parallel) {
execute = Executors.newFixedThreadPool(maxThreads);
futures = new ArrayList<Future<Data<Object>>>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ private static boolean _call(PageContext pc, Object obj, UDF udf, boolean parall

ExecutorService execute = null;
List<Future<Data<Object>>> futures = null;
if (parallel && maxThreads > 1) {
if (maxThreads < 1) maxThreads = 20;
else if (maxThreads == 1) parallel = false;
if (parallel) {
execute = Executors.newFixedThreadPool(maxThreads);
futures = new ArrayList<Future<Data<Object>>>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ private static Collection _call(PageContext pc, Object obj, UDF udf, boolean par

ExecutorService execute = null;
List<Future<Data<Pair<Object, Object>>>> futures = null;
if (parallel && maxThreads > 1) {
if (maxThreads < 1) maxThreads = 20;
else if (maxThreads == 1) parallel = false;
if (parallel) {
execute = Executors.newFixedThreadPool(maxThreads);
futures = new ArrayList<Future<Data<Pair<Object, Object>>>>();
}
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/lucee/runtime/functions/closure/Map.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ private static Collection _call(PageContext pc, Object obj, UDF udf, boolean par

ExecutorService execute = null;
List<Future<Data<Object>>> futures = null;
if (parallel && maxThreads > 1) {
if (maxThreads < 1) maxThreads = 20;
else if (maxThreads == 1) parallel = false;
if (parallel) {
execute = Executors.newFixedThreadPool(maxThreads);
futures = new ArrayList<Future<Data<Object>>>();
}
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/lucee/runtime/functions/closure/Some.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ private static boolean _call(PageContext pc, Object obj, UDF udf, boolean parall

ExecutorService execute = null;
List<Future<Data<Object>>> futures = null;
if (parallel && maxThreads > 1) {
if (maxThreads < 1) maxThreads = 20;
else if (maxThreads == 1) parallel = false;
if (parallel) {
execute = Executors.newFixedThreadPool(maxThreads);
futures = new ArrayList<Future<Data<Object>>>();
}
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.0.1.82-SNAPSHOT"/>
<property name="version" value="6.0.1.83-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.0.1.82-SNAPSHOT</version>
<version>6.0.1.83-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit cef9ba8

Please sign in to comment.