[MNG-6632] - Remember artifact handlers after they've been used once

Otherwise we have to go through the whole sisu engine again,
which is very slow, because it does a linear scan.
This commit is contained in:
Stefan Oehme 2019-04-10 11:40:56 +02:00 committed by Hervé Boutemy
parent d34e8fbdc0
commit 1e03388d5b
1 changed files with 7 additions and 3 deletions

View File

@ -39,11 +39,11 @@ public class DefaultArtifactHandlerManager
@Requirement( role = ArtifactHandler.class ) @Requirement( role = ArtifactHandler.class )
private Map<String, ArtifactHandler> artifactHandlers; private Map<String, ArtifactHandler> artifactHandlers;
private Map<String, ArtifactHandler> unmanagedHandlers = new ConcurrentHashMap<>(); private Map<String, ArtifactHandler> allHandlers = new ConcurrentHashMap<>();
public ArtifactHandler getArtifactHandler( String type ) public ArtifactHandler getArtifactHandler( String type )
{ {
ArtifactHandler handler = unmanagedHandlers.get( type ); ArtifactHandler handler = allHandlers.get( type );
if ( handler == null ) if ( handler == null )
{ {
@ -53,6 +53,10 @@ public class DefaultArtifactHandlerManager
{ {
handler = new DefaultArtifactHandler( type ); handler = new DefaultArtifactHandler( type );
} }
else
{
allHandlers.put( type, handler );
}
} }
return handler; return handler;
@ -61,7 +65,7 @@ public class DefaultArtifactHandlerManager
public void addHandlers( Map<String, ArtifactHandler> handlers ) public void addHandlers( Map<String, ArtifactHandler> handlers )
{ {
// legacy support for maven-gpg-plugin:1.0 // legacy support for maven-gpg-plugin:1.0
unmanagedHandlers.putAll( handlers ); allHandlers.putAll( handlers );
} }
@Deprecated @Deprecated