class LegacyArtifactHandlerManager extends AbstractEventSpy {
    private final Map<String, ArtifactHandler> artifactHandlers;

    private final Map<String, ArtifactHandler> allHandlers = new ConcurrentHashMap<>();

    @Inject
    public LegacyArtifactHandlerManager(Map<String, ArtifactHandler> artifactHandlers) {
        this.artifactHandlers = requireNonNull(artifactHandlers);
    }

    @Override
    public void onEvent(Object event) {<FILL_FUNCTION_BODY>}

    public ArtifactHandler getArtifactHandler(String type) {
        requireNonNull(type, "null type");
        ArtifactHandler handler = allHandlers.get(type);
        if (handler == null) {
            handler = artifactHandlers.get(type);
            if (handler == null) {
                handler = new DefaultArtifactHandler(type);
            } else {
                allHandlers.put(type, handler);
            }
        }
        return handler;
    }
}

        if (event instanceof ExecutionEvent) {
            ExecutionEvent executionEvent = (ExecutionEvent) event;
            if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
                allHandlers.clear();
            }
        }
    
<methods>public non-sealed void <init>() ,public void close() throws java.lang.Exception,public void init(org.apache.maven.eventspy.EventSpy.Context) throws java.lang.Exception,public void onEvent(java.lang.Object) throws java.lang.Exception<variables>