[ https://issues.apache.org/jira/browse/MRESOLVER-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17633610#comment-17633610 ]
ASF GitHub Bot commented on MRESOLVER-291: ------------------------------------------ michael-o commented on code in PR #219: URL: https://github.com/apache/maven-resolver/pull/219#discussion_r1021214425 ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactory.java: ########## @@ -19,23 +19,21 @@ * under the License. */ -import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.RepositorySystemSession; /** - * Selector for {@link NamedLockFactory} and {@link NameMapper} that selects and exposes selected ones. Essentially - * all the named locks configuration is here. Implementations may use different strategies to perform selection. + * Factory for {@link NamedLockFactoryAdapter}. * - * @since 1.7.3 + * @since 1.9.1 */ -public interface NamedLockFactorySelector +public interface NamedLockFactoryAdapterFactory { /** - * Returns the selected {@link NamedLockFactory}, never {@code null}. + * Creates or returns pre-created {@link NamedLockFactoryAdapter}, never {@code null}. + * <p> + * It is left at discretion of implementation what happens on this method call, it may create always new + * instance, or return the same instance. One thing MUST for implementation: to properly shut down Review Comment: new instances ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactory.java: ########## @@ -19,23 +19,21 @@ * under the License. */ -import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.RepositorySystemSession; /** - * Selector for {@link NamedLockFactory} and {@link NameMapper} that selects and exposes selected ones. Essentially - * all the named locks configuration is here. Implementations may use different strategies to perform selection. + * Factory for {@link NamedLockFactoryAdapter}. * - * @since 1.7.3 + * @since 1.9.1 */ -public interface NamedLockFactorySelector +public interface NamedLockFactoryAdapterFactory { /** - * Returns the selected {@link NamedLockFactory}, never {@code null}. + * Creates or returns pre-created {@link NamedLockFactoryAdapter}, never {@code null}. + * <p> + * It is left at discretion of implementation what happens on this method call, it may create always new + * instance, or return the same instance. One thing MUST for implementation: to properly shut down + * any name lock factory it used to create adapter instance. Review Comment: The sentence after the colon reads weird. I do not understand what is required here. ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactory.java: ########## @@ -19,23 +19,21 @@ * under the License. */ -import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.RepositorySystemSession; /** - * Selector for {@link NamedLockFactory} and {@link NameMapper} that selects and exposes selected ones. Essentially - * all the named locks configuration is here. Implementations may use different strategies to perform selection. + * Factory for {@link NamedLockFactoryAdapter}. * - * @since 1.7.3 + * @since 1.9.1 */ -public interface NamedLockFactorySelector +public interface NamedLockFactoryAdapterFactory { /** - * Returns the selected {@link NamedLockFactory}, never {@code null}. + * Creates or returns pre-created {@link NamedLockFactoryAdapter}, never {@code null}. + * <p> + * It is left at discretion of implementation what happens on this method call, it may create always new Review Comment: at the desc.. of the impl... ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactoryImpl.java: ########## @@ -0,0 +1,255 @@ +package org.eclipse.aether.internal.impl.synccontext.named; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.MultiRuntimeException; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.RepositorySystemLifecycle; +import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; +import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.named.providers.FileLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; +import org.eclipse.aether.named.providers.NoopNamedLockFactory; +import org.eclipse.aether.spi.locator.Service; +import org.eclipse.aether.spi.locator.ServiceLocator; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Objects.requireNonNull; + +/** + * Default implementation of {@link NamedLockFactoryAdapterFactory}. By default, this implementation creates Review Comment: "By default" is IMHO Redudant sice this is the default impl, no? ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactoryImpl.java: ########## @@ -0,0 +1,255 @@ +package org.eclipse.aether.internal.impl.synccontext.named; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.MultiRuntimeException; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.RepositorySystemLifecycle; +import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; +import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.named.providers.FileLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; +import org.eclipse.aether.named.providers.NoopNamedLockFactory; +import org.eclipse.aether.spi.locator.Service; +import org.eclipse.aether.spi.locator.ServiceLocator; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Objects.requireNonNull; + +/** + * Default implementation of {@link NamedLockFactoryAdapterFactory}. By default, this implementation creates + * instance of adapter for each call. In turn, on shutdown it cleanly invokes shutdown method of all existing named + * lock factories. If different behavior needed, override the {@link #getAdapter(RepositorySystemSession)} method. + * <p> + * This class most members and methods are protected, and is meant to be extended if needed to customize its behavior. + * Exception from this are private static constants and initializers, mostly meant to provide out of the box + * defaults and to be used when no Eclipse Sisu component container used. + * + * @since 1.9.1 + */ +@Singleton +@Named +public class NamedLockFactoryAdapterFactoryImpl implements NamedLockFactoryAdapterFactory, Service +{ + private static final String DEFAULT_FACTORY_NAME = LocalReadWriteLockNamedLockFactory.NAME; + + private static final String DEFAULT_NAME_MAPPER_NAME = GAVNameMapperProvider.NAME; + + private static Map<String, NamedLockFactory> getManuallyCreatedFactories() + { + HashMap<String, NamedLockFactory> factories = new HashMap<>(); + factories.put( NoopNamedLockFactory.NAME, new NoopNamedLockFactory() ); + factories.put( LocalReadWriteLockNamedLockFactory.NAME, new LocalReadWriteLockNamedLockFactory() ); + factories.put( LocalSemaphoreNamedLockFactory.NAME, new LocalSemaphoreNamedLockFactory() ); + factories.put( FileLockNamedLockFactory.NAME, new FileLockNamedLockFactory() ); + return Collections.unmodifiableMap( factories ); + } + + private static Map<String, NameMapper> getManuallyCreatedNameMappers() + { + HashMap<String, NameMapper> mappers = new HashMap<>(); + mappers.put( StaticNameMapperProvider.NAME, new StaticNameMapperProvider().get() ); + mappers.put( GAVNameMapperProvider.NAME, new GAVNameMapperProvider().get() ); + mappers.put( DiscriminatingNameMapperProvider.NAME, new DiscriminatingNameMapperProvider().get() ); + mappers.put( FileGAVNameMapperProvider.NAME, new FileGAVNameMapperProvider().get() ); + mappers.put( FileHashingGAVNameMapperProvider.NAME, new FileHashingGAVNameMapperProvider().get() ); + return Collections.unmodifiableMap( mappers ); + } + + protected static final String FACTORY_KEY = "aether.syncContext.named.factory"; + + protected static final String NAME_MAPPER_KEY = "aether.syncContext.named.nameMapper"; + + protected final Logger logger = LoggerFactory.getLogger( getClass() ); + + protected final Map<String, NamedLockFactory> factories; + + protected final String defaultFactoryName; + + protected final Map<String, NameMapper> nameMappers; + + protected final String defaultNameMapperName; + + /** + * Default constructor for non Eclipse Sisu uses. + * + * @deprecated for use in SL only. + */ + @Deprecated + public NamedLockFactoryAdapterFactoryImpl() + { + this.factories = getManuallyCreatedFactories(); + this.defaultFactoryName = DEFAULT_FACTORY_NAME; + this.nameMappers = getManuallyCreatedNameMappers(); + this.defaultNameMapperName = DEFAULT_NAME_MAPPER_NAME; + } + + @Override + public void initService( ServiceLocator locator ) + { + locator.getService( RepositorySystemLifecycle.class ).addOnSystemEndedHandler( this::shutdown ); + } + + @Inject + public NamedLockFactoryAdapterFactoryImpl( final Map<String, NamedLockFactory> factories, + final Map<String, NameMapper> nameMappers, + final RepositorySystemLifecycle lifecycle ) + { + this( factories, DEFAULT_FACTORY_NAME, nameMappers, DEFAULT_NAME_MAPPER_NAME, lifecycle ); + } + + public NamedLockFactoryAdapterFactoryImpl( final Map<String, NamedLockFactory> factories, + final String defaultFactoryName, + final Map<String, NameMapper> nameMappers, + final String defaultNameMapperName, + final RepositorySystemLifecycle lifecycle ) + { + this.factories = requireNonNull( factories ); + this.defaultFactoryName = requireNonNull( defaultFactoryName ); + this.nameMappers = requireNonNull( nameMappers ); + this.defaultNameMapperName = requireNonNull( defaultNameMapperName ); + lifecycle.addOnSystemEndedHandler( this::shutdown ); + + logger.debug( "Created adapter factory; available factories {}; available name mappers {}", Review Comment: Nice and helpful! ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactoryImpl.java: ########## @@ -0,0 +1,255 @@ +package org.eclipse.aether.internal.impl.synccontext.named; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.MultiRuntimeException; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.RepositorySystemLifecycle; +import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; +import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.named.providers.FileLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; +import org.eclipse.aether.named.providers.NoopNamedLockFactory; +import org.eclipse.aether.spi.locator.Service; +import org.eclipse.aether.spi.locator.ServiceLocator; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Objects.requireNonNull; + +/** + * Default implementation of {@link NamedLockFactoryAdapterFactory}. By default, this implementation creates + * instance of adapter for each call. In turn, on shutdown it cleanly invokes shutdown method of all existing named Review Comment: instances of the the adapter on every call. ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactory.java: ########## @@ -19,23 +19,21 @@ * under the License. */ -import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.RepositorySystemSession; /** - * Selector for {@link NamedLockFactory} and {@link NameMapper} that selects and exposes selected ones. Essentially - * all the named locks configuration is here. Implementations may use different strategies to perform selection. + * Factory for {@link NamedLockFactoryAdapter}. * - * @since 1.7.3 + * @since 1.9.1 */ -public interface NamedLockFactorySelector +public interface NamedLockFactoryAdapterFactory { /** - * Returns the selected {@link NamedLockFactory}, never {@code null}. + * Creates or returns pre-created {@link NamedLockFactoryAdapter}, never {@code null}. + * <p> + * It is left at discretion of implementation what happens on this method call, it may create always new + * instance, or return the same instance. One thing MUST for implementation: to properly shut down Review Comment: One this is required for the impl... ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactoryImpl.java: ########## @@ -0,0 +1,255 @@ +package org.eclipse.aether.internal.impl.synccontext.named; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.MultiRuntimeException; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.RepositorySystemLifecycle; +import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; +import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.named.providers.FileLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; +import org.eclipse.aether.named.providers.NoopNamedLockFactory; +import org.eclipse.aether.spi.locator.Service; +import org.eclipse.aether.spi.locator.ServiceLocator; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Objects.requireNonNull; + +/** + * Default implementation of {@link NamedLockFactoryAdapterFactory}. By default, this implementation creates + * instance of adapter for each call. In turn, on shutdown it cleanly invokes shutdown method of all existing named + * lock factories. If different behavior needed, override the {@link #getAdapter(RepositorySystemSession)} method. + * <p> + * This class most members and methods are protected, and is meant to be extended if needed to customize its behavior. + * Exception from this are private static constants and initializers, mostly meant to provide out of the box + * defaults and to be used when no Eclipse Sisu component container used. Review Comment: is used ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactoryImpl.java: ########## @@ -0,0 +1,255 @@ +package org.eclipse.aether.internal.impl.synccontext.named; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.MultiRuntimeException; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.RepositorySystemLifecycle; +import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; +import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.named.providers.FileLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; +import org.eclipse.aether.named.providers.NoopNamedLockFactory; +import org.eclipse.aether.spi.locator.Service; +import org.eclipse.aether.spi.locator.ServiceLocator; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Objects.requireNonNull; + +/** + * Default implementation of {@link NamedLockFactoryAdapterFactory}. By default, this implementation creates + * instance of adapter for each call. In turn, on shutdown it cleanly invokes shutdown method of all existing named + * lock factories. If different behavior needed, override the {@link #getAdapter(RepositorySystemSession)} method. + * <p> + * This class most members and methods are protected, and is meant to be extended if needed to customize its behavior. + * Exception from this are private static constants and initializers, mostly meant to provide out of the box Review Comment: An exception from... ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactoryImpl.java: ########## @@ -0,0 +1,255 @@ +package org.eclipse.aether.internal.impl.synccontext.named; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.MultiRuntimeException; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.RepositorySystemLifecycle; +import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; +import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.named.providers.FileLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; +import org.eclipse.aether.named.providers.NoopNamedLockFactory; +import org.eclipse.aether.spi.locator.Service; +import org.eclipse.aether.spi.locator.ServiceLocator; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Objects.requireNonNull; + +/** + * Default implementation of {@link NamedLockFactoryAdapterFactory}. By default, this implementation creates + * instance of adapter for each call. In turn, on shutdown it cleanly invokes shutdown method of all existing named + * lock factories. If different behavior needed, override the {@link #getAdapter(RepositorySystemSession)} method. + * <p> + * This class most members and methods are protected, and is meant to be extended if needed to customize its behavior. Review Comment: Most members and methods of this class are protected. It is meants to... ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactoryImpl.java: ########## @@ -0,0 +1,255 @@ +package org.eclipse.aether.internal.impl.synccontext.named; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.MultiRuntimeException; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.RepositorySystemLifecycle; +import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; +import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.named.providers.FileLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; +import org.eclipse.aether.named.providers.NoopNamedLockFactory; +import org.eclipse.aether.spi.locator.Service; +import org.eclipse.aether.spi.locator.ServiceLocator; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Objects.requireNonNull; + +/** + * Default implementation of {@link NamedLockFactoryAdapterFactory}. By default, this implementation creates + * instance of adapter for each call. In turn, on shutdown it cleanly invokes shutdown method of all existing named Review Comment: the shutdown method ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapterFactoryImpl.java: ########## @@ -0,0 +1,255 @@ +package org.eclipse.aether.internal.impl.synccontext.named; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.MultiRuntimeException; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.RepositorySystemLifecycle; +import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; +import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; +import org.eclipse.aether.named.NamedLockFactory; +import org.eclipse.aether.named.providers.FileLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; +import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; +import org.eclipse.aether.named.providers.NoopNamedLockFactory; +import org.eclipse.aether.spi.locator.Service; +import org.eclipse.aether.spi.locator.ServiceLocator; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Objects.requireNonNull; + +/** + * Default implementation of {@link NamedLockFactoryAdapterFactory}. By default, this implementation creates + * instance of adapter for each call. In turn, on shutdown it cleanly invokes shutdown method of all existing named + * lock factories. If different behavior needed, override the {@link #getAdapter(RepositorySystemSession)} method. Review Comment: is needed > Undo MRESOLVER-284 > ------------------ > > Key: MRESOLVER-291 > URL: https://issues.apache.org/jira/browse/MRESOLVER-291 > Project: Maven Resolver > Issue Type: Task > Components: Resolver > Reporter: Tamas Cservenak > Assignee: Tamas Cservenak > Priority: Major > Fix For: 1.9.1 > > > No semantics change, merely do not expect ctor config injection, use session > configuration params for everything as originally intended. > The MRESOLVER-284 "breaking" part should be undone. -- This message was sent by Atlassian Jira (v8.20.10#820010)