Skip to content

Commit

Permalink
refactor(atomix): implement AutoCloseable for managed services
Browse files Browse the repository at this point in the history
  • Loading branch information
npepinpe committed Nov 7, 2023
1 parent 415b2cf commit bb34091
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion atomix/utils/src/main/java/io/atomix/utils/Managed.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @param <T> managed type
*/
public interface Managed<T> {
public interface Managed<T> extends AutoCloseable {

/**
* Starts the managed object.
Expand All @@ -45,4 +45,9 @@ public interface Managed<T> {
* @return A completable future to be completed once the object has been stopped.
*/
CompletableFuture<Void> stop();

@Override
default void close() throws Exception {
stop().join();
}
}

0 comments on commit bb34091

Please sign in to comment.