grpc / grpc/grpc-java

Feature: Lifecycle events for service implementations

Ouverte
#3,449 10 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
12.1k
Forks
4k
Merge moyen
2 j 17 h
PR mergées (30 j)
37

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
backend-api-design
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.