Skip to content

Graceful shutdown - defaults for io.ebean.Database to shutdown() last #820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025

Conversation

rbygrave
Copy link
Contributor

@rbygrave rbygrave commented May 22, 2025

For graceful shutdown, we desire components to shutdown in an appropriate order. For io.ebean.Database it should be shutdown last.

Adds a default shutdown method and shutdown priority for special components such that they default to doing "the right thing" wrt graceful shutdown.

For ebean:

  @Bean
  Database database()

We desire that to effectively default to:

  @Bean(destroyMethod = "shutdown", destroyPriority = Integer.MAX_VALUE)
  Database database()

... we want the generated code to have addPreDestroy() like:

var bean = factory.database(builder.get(ConfigWrapper.class,"!config"));
var $bean = builder.register(bean);
builder.addPreDestroy($bean::shutdown, 2147483647);

For graceful shutdown, we desire components to shutdown in an appropriate order. For io.ebean.Database it should be shutdown last.

Adds a default shutdown method and shutdown priority for special components such that they default to doing "the right thing" wrt graceful shutdown.

For ebean:

```java
  @bean
  Database database()
```
We desire that to default to:
```java
  @bean(destroyMethod = "shutdown", destroyPriority = Integer.MAX_VALUE)
  Database database()
```
@rbygrave rbygrave requested a review from SentryMan May 22, 2025 08:45
@rbygrave rbygrave self-assigned this May 22, 2025
@rbygrave rbygrave merged commit 344cf3b into master May 22, 2025
9 checks passed
@rbygrave rbygrave deleted the feature/defaultShutdown branch May 22, 2025 19:58
@SentryMan SentryMan added this to the 11.6 milestone May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants