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.impl; 020 021import org.eclipse.aether.RepositorySystemSession.CloseableSession; 022 023/** 024 * Lifecycle managing component for repository system. 025 * 026 * @noimplement This interface is not intended to be implemented by clients. 027 * @noextend This interface is not intended to be extended by clients. 028 * @provisional This type is provisional and can be changed, moved or removed without prior notice. 029 * @since 1.9.0 030 */ 031public interface RepositorySystemLifecycle { 032 /** 033 * Marks the repository system as ended (shut down): all "on close" handlers will be invoked. This method may be 034 * invoked multiple times, only once will execute, subsequent calls will be no-op. 035 */ 036 void systemEnded(); 037 038 /** 039 * Registers an "on repository system end" handler. 040 * <p> 041 * Throws if repository system is already shut down. 042 */ 043 void addOnSystemEndedHandler(Runnable handler); 044 045 /** 046 * Registers the session for lifecycle tracking: it marks that the passed in session instance is about to start. 047 * <p> 048 * <em>Same session instance can be started only once.</em> 049 * 050 * @since 2.0.0 051 */ 052 void sessionStarted(CloseableSession session); 053 054 /** 055 * Signals that passed in session was ended, it will not be used anymore. Repository system 056 * will invoke the registered handlers for this session, if any. This method throws if the passed in session 057 * instance was not passed to method {@link #sessionStarted(CloseableSession)} beforehand. 058 * <p> 059 * <em>Same session instance can be ended only once.</em> 060 * 061 * @since 2.0.0 062 */ 063 void sessionEnded(CloseableSession session); 064 065 /** 066 * Registers an "on session end" handler. 067 * <p> 068 * Throws if session was not passed to {@link #sessionStarted(CloseableSession)} beforehand. 069 * 070 * @since 2.0.0 071 */ 072 void addOnSessionEndedHandle(CloseableSession session, Runnable handler); 073}