Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ public void get(
RunnableErrorForwarder errorForwarder = new RunnableErrorForwarder();
List<ChecksumAlgorithmFactory> checksumAlgorithmFactories = layout.getChecksumAlgorithmFactories();

boolean first = true;

for (MetadataDownload transfer : safeMetadataDownloads) {
URI location = layout.getLocation(transfer.getMetadata(), false);

Expand All @@ -211,12 +209,7 @@ public void get(
checksumLocations,
null,
listener);
if (first) {
task.run();
first = false;
} else {
executor.execute(errorForwarder.wrap(task));
}
executor.execute(errorForwarder.wrap(task));
}

for (ArtifactDownload transfer : safeArtifactDownloads) {
Expand Down Expand Up @@ -256,12 +249,7 @@ public void get(
providedChecksums,
listener);
}
if (first) {
task.run();
first = false;
} else {
executor.execute(errorForwarder.wrap(task));
}
executor.execute(errorForwarder.wrap(task));
}

errorForwarder.await();
Expand All @@ -279,8 +267,6 @@ public void put(
Executor executor = getExecutor(parallelPut ? safeArtifactUploads.size() + safeMetadataUploads.size() : 1);
RunnableErrorForwarder errorForwarder = new RunnableErrorForwarder();

boolean first = true;

for (ArtifactUpload transfer : safeArtifactUploads) {
URI location = layout.getLocation(transfer.getArtifact(), true);

Expand All @@ -293,12 +279,8 @@ public void put(

Runnable task = new PutTaskRunner(
location, transfer.getFile(), transfer.getFileTransformer(), checksumLocations, listener);
if (first) {
task.run();
first = false;
} else {
executor.execute(errorForwarder.wrap(task));
}

executor.execute(errorForwarder.wrap(task));
}

errorForwarder.await(); // make sure all artifacts are PUT before we go with Metadata
Expand All @@ -315,12 +297,8 @@ public void put(
layout.getChecksumLocations(transfer.getMetadata(), true, location);

Runnable task = new PutTaskRunner(location, transfer.getFile(), checksumLocations, listener);
if (first) {
task.run();
first = false;
} else {
executor.execute(errorForwarder.wrap(task));
}

executor.execute(errorForwarder.wrap(task));
}

errorForwarder.await(); // make sure each group is done before starting next group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private static Runnable resolveWithDependencies(
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, null);
List<ArtifactResult> artifactResults =
system.resolveDependencies(session, dependencyRequest).getArtifactResults();
int resolved = 9;
int resolved = 0;
int fails = 0;
for (ArtifactResult artifactResult : artifactResults) {
if (artifactResult.isResolved()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.http.auth.AuthScope;
import org.apache.http.auth.Credentials;
Expand All @@ -39,11 +39,11 @@ final class DeferredCredentialsProvider implements CredentialsProvider {

private final CredentialsProvider delegate;

private final Map<AuthScope, Factory> factories;
private final ConcurrentHashMap<AuthScope, Factory> factories;

DeferredCredentialsProvider() {
delegate = new BasicCredentialsProvider();
factories = new HashMap<>();
factories = new ConcurrentHashMap<>();
}

public void setCredentials(AuthScope authScope, Factory factory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
package org.eclipse.aether.transport.http;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScheme;
Expand All @@ -33,11 +33,11 @@ final class SharingAuthCache implements AuthCache {

private final LocalState state;

private final Map<HttpHost, AuthScheme> authSchemes;
private final ConcurrentHashMap<HttpHost, AuthScheme> authSchemes;

SharingAuthCache(LocalState state) {
this.state = state;
authSchemes = new HashMap<>();
authSchemes = new ConcurrentHashMap<>();
}

private static HttpHost toKey(HttpHost host) {
Expand All @@ -54,17 +54,20 @@ public AuthScheme get(HttpHost host) {
AuthScheme authScheme = authSchemes.get(host);
if (authScheme == null) {
authScheme = state.getAuthScheme(host);
authSchemes.put(host, authScheme);
if (authScheme != null) {
authSchemes.put(host, authScheme);
}
}
return authScheme;
}

@Override
public void put(HttpHost host, AuthScheme authScheme) {
host = toKey(host);
if (authScheme != null) {
authSchemes.put(toKey(host), authScheme);
authSchemes.put(host, authScheme);
} else {
remove(host);
authSchemes.remove(host);
}
}

Expand Down