@Singleton @Named(value="discriminating") public class DiscriminatingNameMapper extends Object implements NameMapper
NameMapper
, that wraps another NameMapper
and adds a "discriminator" as prefix, that
makes lock names unique including the hostname and local repository (by default). The discriminator may be passed
in via RepositorySystemSession
or is automatically calculated based on the local hostname and repository
path. The implementation retains order of collection elements as it got it from
NameMapper.nameLocks(RepositorySystemSession, Collection, Collection)
method.
The default setup wraps GAVNameMapper
, but manually may be created any instance needed.
Constructor and Description |
---|
DiscriminatingNameMapper(NameMapper nameMapper) |
Modifier and Type | Method and Description |
---|---|
Collection<String> |
nameLocks(org.eclipse.aether.RepositorySystemSession session,
Collection<? extends org.eclipse.aether.artifact.Artifact> artifacts,
Collection<? extends org.eclipse.aether.metadata.Metadata> metadatas)
Creates (opaque) names for passed in artifacts and metadata.
|
public static final String NAME
@Inject public DiscriminatingNameMapper(@Named(value="gav") NameMapper nameMapper)
public Collection<String> nameLocks(org.eclipse.aether.RepositorySystemSession session, Collection<? extends org.eclipse.aether.artifact.Artifact> artifacts, Collection<? extends org.eclipse.aether.metadata.Metadata> metadatas)
NameMapper
null
. The resulting collection MUST BE "stable" (always sorted by
same criteria) to avoid deadlocks by acquiring locks in same order, essentially disregarding the order of
the input collections.nameLocks
in interface NameMapper
Copyright © 2010–2022 The Apache Software Foundation. All rights reserved.