Feature: Lifecycle events for service implementations
- Lingua principale
- Java
- Stelle
- 12.1k
- Fork
- 4k
- Merge medio
- 2g 17h
- PR unite (30g)
- 37
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.