You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2023/02/07 13:26:18 UTC
[maven-resolver] branch master updated: [MRESOLVER-319] Parallel Deploy Support (#240)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new 8c9ae638 [MRESOLVER-319] Parallel Deploy Support (#240)
8c9ae638 is described below
commit 8c9ae638f56966f27422c8f63e1c9c88bce02609
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Feb 7 14:26:11 2023 +0100
[MRESOLVER-319] Parallel Deploy Support (#240)
Make basic connector be able to perform parallel PUTs in very same manner as it did so far parallel GETs.
Still, there is a "safety switch" to turn off this new feature that is ENABLED by default.
Effects:
* set threads to 1: GET and PUT are executed sequentially
* set parallelPut to false: Behave as Maven 3.8.x line was
* default: perform parallel GETs and PUTs
---
https://issues.apache.org/jira/browse/MRESOLVER-319
---
.../connector/basic/BasicRepositoryConnector.java | 17 +++++++++++++++--
src/site/markdown/configuration.md | 1 +
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
index 60f7412d..e7ff2e94 100644
--- a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
+++ b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
@@ -82,6 +82,8 @@ final class BasicRepositoryConnector
private static final String CONFIG_PROP_SMART_CHECKSUMS = "aether.connector.smartChecksums";
+ private static final String CONFIG_PROP_PARALLEL_PUT = "aether.connector.basic.parallelPut";
+
private static final Logger LOGGER = LoggerFactory.getLogger( BasicRepositoryConnector.class );
private final Map<String, ProvidedChecksumsSource> providedChecksumsSources;
@@ -102,6 +104,8 @@ final class BasicRepositoryConnector
private final boolean smartChecksums;
+ private final boolean parallelPut;
+
private final boolean persistedChecksums;
private Executor executor;
@@ -143,6 +147,8 @@ final class BasicRepositoryConnector
maxThreads = ExecutorUtils.threadCount( session, 5, CONFIG_PROP_THREADS, "maven.artifact.threads" );
smartChecksums = ConfigUtils.getBoolean( session, true, CONFIG_PROP_SMART_CHECKSUMS );
+ parallelPut = ConfigUtils.getBoolean( session, true,
+ CONFIG_PROP_PARALLEL_PUT + "." + repository.getId(), CONFIG_PROP_PARALLEL_PUT );
persistedChecksums =
ConfigUtils.getBoolean( session, ConfigurationProperties.DEFAULT_PERSISTED_CHECKSUMS,
ConfigurationProperties.PERSISTED_CHECKSUMS );
@@ -284,6 +290,9 @@ final class BasicRepositoryConnector
Collection<? extends ArtifactUpload> safeArtifactUploads = safe( artifactUploads );
Collection<? extends MetadataUpload> safeMetadataUploads = safe( metadataUploads );
+ Executor executor = getExecutor( parallelPut ? safeArtifactUploads.size() + safeMetadataUploads.size() : 1 );
+ RunnableErrorForwarder errorForwarder = new RunnableErrorForwarder();
+
for ( ArtifactUpload transfer : safeArtifactUploads )
{
URI location = layout.getLocation( transfer.getArtifact(), true );
@@ -298,9 +307,11 @@ final class BasicRepositoryConnector
Runnable task = new PutTaskRunner( location, transfer.getFile(), transfer.getFileTransformer(),
checksumLocations, listener );
- task.run();
+ executor.execute( errorForwarder.wrap( task ) );
}
+ errorForwarder.await(); // make sure all artifacts are PUT before we go with Metadata
+
for ( MetadataUpload transfer : safeMetadataUploads )
{
URI location = layout.getLocation( transfer.getMetadata(), true );
@@ -314,8 +325,10 @@ final class BasicRepositoryConnector
Runnable task = new PutTaskRunner( location, transfer.getFile(), checksumLocations, listener );
- task.run();
+ executor.execute( errorForwarder.wrap( task ) );
}
+
+ errorForwarder.await();
}
private static <T> Collection<T> safe( Collection<T> items )
diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md
index fe03055a..18e14794 100644
--- a/src/site/markdown/configuration.md
+++ b/src/site/markdown/configuration.md
@@ -31,6 +31,7 @@ Option | Type | Description | Default Value | Supports Repo ID Suffix
`aether.checksums.algorithms` | String | Comma-separated list of checksum algorithms with which checksums are validated (downloaded) and generated (uploaded). Resolver by default supports following algorithms: `MD5`, `SHA-1`, `SHA-256` and `SHA-512`. New algorithms can be added by implementing `ChecksumAlgorithmFactory` component. | `"SHA-1,MD5"` | no
`aether.conflictResolver.verbose` | boolean | Flag controlling the conflict resolver's verbose mode. | `false` | no
`aether.connector.basic.threads` or `maven.artifact.threads` | int | Number of threads to use for uploading/downloading. | `5` | no
+`aether.connector.basic.parallelPut` | boolean | Enables or disables parallel PUT processing (parallel deploys) on basic connector globally or per remote repository. When disabled, connector behaves exactly as in Maven 3.8.x did: GETs are parallel while PUTs are sequential. | `true` | yes
`aether.connector.classpath.loader` | ClassLoader | `ClassLoader` from which resources should be retrieved which start with the `classpath:` protocol. | `Thread.currentThread().getContextClassLoader()` | no
`aether.connector.connectTimeout` | long | Connect timeout in milliseconds. | `10000` | yes
`aether.connector.http.cacheState` | boolean | Flag indicating whether a memory-based cache is used for user tokens, connection managers, expect continue requests and authentication schemes. | `true` | no