grpc / grpc/grpc-java

Feature: Lifecycle events for service implementations

Abierto
#3,449 10 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
12.1k
Forks
4k
Merge medio
2 d 17 h
PR fusionados (30 d)
37

Descripción

I'd like my service implementations to be notified of server lifecycle events for server start and shutdown. These operations could be used to warm caches, persist data, or close files.

The least intrusive implementation would be an interface a service implementer would opt into for receiving these events. Ex:
```java
public interface ServiceLifecycle {
// Called when Server.start() is called
void onStart(...);

// Called when Server.shutdown() or Server.shutdownNow() is called
void onShutdown(boolean hard, ...);
}
```

My initial thought is that `onStart()` would block `Server.start()`, so that the server wouldn't be ready until all services had successfully started. `onShutdown()` is trickier. It needs to be called only after the server has drained all requests.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start by reading the Server.start(), Server.shutdown(), and Server.shutdownNow() entry points and how service implementations are managed. Define the lifecycle contract, including startup blocking and shutdown after requests drain, then add coverage for normal and hard shutdown behavior.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
backend-api-design
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.