001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.eclipse.aether.spi.locking;
020
021import java.util.Optional;
022
023import org.eclipse.aether.RepositorySystemSession;
024
025/**
026 * A factory to create {@link LockingInhibitor} instances, that are capable to augment Resolver locking subsystem and
027 * prevent locking to happen on certain resources.
028 * <p>
029 * <em>Warning: locking inhibition should be applied ONLY to resources that do not conflict on disk (i.e. local
030 * repository) and are NOT produced/written or altered in any way by Resolver, merely cached and read. Hence, despite
031 * artifact locking inhibition is given as option, it should never happen in fact, as aforementioned conditions
032 * never stand for them. On the other hand, good examples of resources may be needing locking inhibition are
033 * archetype catalogs and RRF prefix files, as both are metadata, hence their remotely fetched cache entries do not
034 * conflict locally, furthermore both are produced by remote entities only, and are just cached and read by Maven.</em>
035 *
036 * @since 2.0.14
037 */
038public interface LockingInhibitorFactory {
039    /**
040     * May return a {@link LockingInhibitor} or just empty {@link Optional}, if for example disabled.
041     */
042    Optional<LockingInhibitor> newInstance(RepositorySystemSession session);
043}