Skip to content

Commit 01a9c05

Browse files
authored
Merge pull request #396 from xdev-software/develop
Release
2 parents da3576c + 17add39 commit 01a9c05

49 files changed

Lines changed: 688 additions & 236 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.config/pmd/java/ruleset.xml

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<rule ref="category/java/codestyle.xml/NoPackage"/>
4343
<rule ref="category/java/codestyle.xml/PrematureDeclaration"/>
4444
<rule ref="category/java/codestyle.xml/UnnecessarySemicolon"/>
45+
<rule ref="category/java/codestyle.xml/VariableCanBeInlined"/>
4546

4647
<rule ref="category/java/design.xml">
4748
<!-- Sometimes abstract classes have just fields -->
@@ -138,6 +139,7 @@
138139
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators"/>
139140
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
140141
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
142+
<rule ref="category/java/errorprone.xml/CollectionTypeMismatch"/>
141143
<rule ref="category/java/errorprone.xml/ComparisonWithNaN"/>
142144
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
143145
<rule ref="category/java/errorprone.xml/DontImportSun"/>
@@ -155,7 +157,7 @@
155157
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance"/>
156158
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
157159
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>
158-
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable"/>
160+
<rule ref="category/java/errorprone.xml/UselessPureMethodCall"/>
159161

160162

161163
<rule ref="category/java/multithreading.xml">
@@ -218,6 +220,71 @@
218220
</properties>
219221
</rule>
220222

223+
<rule name="AvoidPostConstruct"
224+
language="java"
225+
message="Avoid @PostConstruct"
226+
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule">
227+
<description>
228+
Using a `@PostConstruct` method is usually only done when field injection is used and initialization needs to be performed after that.
229+
230+
It's better to do this directly in the constructor with constructor injection, so that all logic will be encapsulated there.
231+
This also makes using the bean in environments where JavaEE is not present - for example in tests - a lot easier, as forgetting to call the `@PostConstruct` method is no longer possible.
232+
</description>
233+
<priority>3</priority>
234+
<properties>
235+
<property name="xpath">
236+
<value>
237+
<![CDATA[
238+
//MethodDeclaration[pmd-java:hasAnnotation('jakarta.annotation.PostConstruct')]
239+
]]>
240+
</value>
241+
</property>
242+
</properties>
243+
</rule>
244+
245+
<rule name="AvoidPreDestroy"
246+
language="java"
247+
message="Avoid @PreDestroy"
248+
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule">
249+
<description>
250+
`@PreDestroy` should be replaced by implementing `AutoCloseable` and overwriting the `close` method instead.
251+
252+
This also makes using the bean in environments where JavaEE is not present - for example in tests - a lot easier, as forgetting to call the `@PreDestroy` method is no much more difficult.
253+
</description>
254+
<priority>3</priority>
255+
<properties>
256+
<property name="xpath">
257+
<value>
258+
<![CDATA[
259+
//MethodDeclaration[pmd-java:hasAnnotation('jakarta.annotation.PreDestroy')]
260+
]]>
261+
</value>
262+
</property>
263+
</properties>
264+
</rule>
265+
266+
<rule name="AvoidUnmanagedThreads"
267+
language="java"
268+
message="Avoid unmanaged threads"
269+
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule">
270+
<description>
271+
Trying to manually manage threads usually gets quickly out of control and may result in various problems like uncontrollable spawning of threads.
272+
Threads can also not be cancelled properly.
273+
274+
Use managed Thread services like `ExecutorService` and `CompletableFuture` instead.
275+
</description>
276+
<priority>3</priority>
277+
<properties>
278+
<property name="xpath">
279+
<value>
280+
<![CDATA[
281+
//MethodCall[pmd-java:matchesSig('java.lang.Thread#start()') or pmd-java:matchesSig('java.lang.Thread#startVirtualThread(java.lang.Runnable)') or pmd-java:matchesSig('java.lang.Thread$Builder#start(java.lang.Runnable)')]
282+
]]>
283+
</value>
284+
</property>
285+
</properties>
286+
</rule>
287+
221288
<rule name="JavaObjectSerializationIsUnsafe"
222289
language="java"
223290
message="Using Java Object (De-)Serialization is unsafe and has led to too many security vulnerabilities"

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
8888
- name: Create Release
8989
id: create-release
90-
uses: shogo82148/actions-create-release@4661dc54f7b4b564074e9fbf73884d960de569a3 # v1
90+
uses: shogo82148/actions-create-release@7b89596097b26731bda0852f1504f813499079ee # v1
9191
with:
9292
tag_name: v${{ steps.version.outputs.release }}
9393
release_name: v${{ steps.version.outputs.release }}

.idea/codeStyles/Project.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
1+
wrapperVersion=3.3.4
2+
distributionType=only-script
173
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# 2.7.0
2+
* ExecutorService creation is now controlled centrally (`ExecutorServiceCreator`)
3+
* All created ExecutorServices now use `VirtualThread`s on Java 21+
4+
* Use explicitly defined `ExecutorService` - wherever possible
5+
* _Context_: `CompletableFuture#runAsync`, `CompletableFuture#supplyAsync` and `parallelStream` use Java's common pool.<br/>
6+
However calling these methods is usually done (in TCI) for I/O tasks.<br/>
7+
This might exhaust the common pool thus negatively impacting performance.<br/>
8+
It was therefore decided to use dedicated pools instead.
9+
* Stored in `TCIExecutorServiceHolder`
10+
* Utilizes a `CachedThreadPool` (for Java `<` 21)
11+
* On Java21+ it uses `VirtualThread`s for better scaling
12+
* Other minor improvements
13+
* Add missing timeout when pulling `SeleniumRecordingContainer`
14+
* Removed uses of `String.replaceAll("<Regex>", "")` and compiled pattern instead only once
15+
* Updated dependencies
16+
117
# 2.6.0
218
* ``db-jdbc-spring-*``
319
* Added ``DynamicPersistenceClassFinder``
Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
1+
wrapperVersion=3.3.4
2+
distributionType=only-script
173
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

advanced-demo/entities-metamodel/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.xdev.tci.demo</groupId>
99
<artifactId>advanced-demo</artifactId>
10-
<version>2.6.1-SNAPSHOT</version>
10+
<version>2.7.0-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>entities-metamodel</artifactId>
1313

advanced-demo/entities/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.xdev.tci.demo</groupId>
99
<artifactId>advanced-demo</artifactId>
10-
<version>2.6.1-SNAPSHOT</version>
10+
<version>2.7.0-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>entities</artifactId>
1313

advanced-demo/integration-tests/persistence-it/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.xdev.tci.demo.it</groupId>
99
<artifactId>integration-tests</artifactId>
10-
<version>2.6.1-SNAPSHOT</version>
10+
<version>2.7.0-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>persistence-it</artifactId>
1313

advanced-demo/integration-tests/persistence-it/src/test/java/software/xdev/tci/demo/persistence/base/BaseTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.slf4j.Logger;
1919
import org.slf4j.LoggerFactory;
2020

21+
import software.xdev.tci.concurrent.TCIExecutorServiceHolder;
2122
import software.xdev.tci.dao.DAOInjector;
2223
import software.xdev.tci.db.persistence.TransactionExecutor;
2324
import software.xdev.tci.demo.persistence.FlywayInfo;
@@ -136,7 +137,7 @@ protected void stopInfra()
136137
if(this.dbInfra != null)
137138
{
138139
final DBTCI fDbInfra = this.dbInfra;
139-
CompletableFuture.runAsync(fDbInfra::stop);
140+
CompletableFuture.runAsync(fDbInfra::stop, TCIExecutorServiceHolder.instance());
140141

141142
this.dbInfra = null;
142143
}

0 commit comments

Comments
 (0)