Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRESOLVER-278] On repository system shutdown #209

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* 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
Expand All @@ -20,7 +20,6 @@
*/

import java.util.Map;
import java.util.function.Consumer;

import org.eclipse.aether.artifact.ArtifactTypeRegistry;
import org.eclipse.aether.collection.DependencyGraphTransformer;
Expand All @@ -41,10 +40,10 @@

/**
* A special repository system session to enable decorating or proxying another session. To do so, clients have to
* create a subclass and implement {@link #getSession()}.
* create a subclass and implement {@link #getSession()}, and optionally override other methods.
*/
public abstract class AbstractForwardingRepositorySystemSession
implements RepositorySystemSession
implements RepositorySystemSession
{

/**
Expand All @@ -58,7 +57,7 @@ protected AbstractForwardingRepositorySystemSession()
* Gets the repository system session to which this instance forwards calls. It's worth noting that this class does
* not save/cache the returned reference but queries this method before each forwarding. Hence, the session
* forwarded to may change over time or depending on the context (e.g. calling thread).
*
*
* @return The repository system session to forward calls to, never {@code null}.
*/
protected abstract RepositorySystemSession getSession();
Expand Down Expand Up @@ -212,34 +211,10 @@ public RepositoryCache getCache()
{
return getSession().getCache();
}

@Override
public FileTransformerManager getFileTransformerManager()
{
return getSession().getFileTransformerManager();
}

@Override
public final void addOnCloseHandler( Consumer<RepositorySystemSession> handler )
{
getSession().addOnCloseHandler( handler );
}

@Override
public final boolean isClosed()
{
return getSession().isClosed();
}

/**
* This method is special: by default it throws (nested session should never be closed), the "top level" session
* should be closed instead. Still, this method is NOT {@code final}, to allow implementations overriding it,
* and in case when needed, handle forwarded session as "top level" session.
*/
@Override
public void close()
{
throw new IllegalStateException( "Forwarding session should not be closed, "
+ "close the top-level (forwarded) session instead." );
}
}
Loading