michael-o commented on code in PR #196:
URL: https://github.com/apache/maven-resolver/pull/196#discussion_r979299465
##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/DefaultSyncContextFactory.java:
##########
@@ -44,20 +58,41 @@
public final class DefaultSyncContextFactory
implements SyncContextFactory, Service
{
- private NamedLockFactoryAdapter namedLockFactoryAdapter;
+ private static final Logger LOGGER = LoggerFactory.getLogger(
DefaultSyncContextFactory.class );
+
+ private static final String ADAPTER_KEY =
DefaultSyncContextFactory.class.getName() + ".adapter";
+
+ private static final String NAME_MAPPER_KEY =
"aether.syncContext.named.nameMapper";
+
+ private static final String DEFAULT_NAME_MAPPER = GAVNameMapper.NAME;
+
+ private static final String FACTORY_KEY =
"aether.syncContext.named.factory";
+
+ private static final String DEFAULT_FACTORY =
LocalReadWriteLockNamedLockFactory.NAME;
+
+ private Map<String, NameMapper> nameMappers;
+
+ private Map<String, NamedLockFactory> namedLockFactories;
+
+ private final CopyOnWriteArrayList<NamedLockFactoryAdapter>
createdAdapters = new CopyOnWriteArrayList<>();
/**
* Constructor used with DI, where factories are injected and selected
based on key.
*/
@Inject
- public DefaultSyncContextFactory( final NamedLockFactorySelector selector )
+ public DefaultSyncContextFactory( final Map<String, NameMapper>
nameMappers,
+ final Map<String, NamedLockFactory>
namedLockFactories )
{
- this.namedLockFactoryAdapter = new NamedLockFactoryAdapter(
- selector.getSelectedNameMapper(),
- selector.getSelectedNamedLockFactory()
- );
+ this.nameMappers = requireNonNull( nameMappers );
+ this.namedLockFactories = requireNonNull( namedLockFactories );
Review Comment:
Very nice of Sisu! Thanks for the explanation. Empty check would be
counter-productive here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]