Skip to content
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

improve Javadoc for VertxInstance stuff #1143

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@

import io.vertx.core.Vertx;

import org.hibernate.reactive.pool.impl.DefaultSqlClientPool;
import org.hibernate.service.Service;

/**
* Used by {@link DefaultSqlClientPool} and
* {@link org.hibernate.reactive.context.impl.VertxContext}
* to obtain an instance of {@link Vertx}. The default instance is
* {@link org.hibernate.reactive.vertx.impl.DefaultVertxInstance}.
* Used by {@link org.hibernate.reactive.pool.impl.DefaultSqlClientPool}
* and {@link org.hibernate.reactive.context.impl.VertxContext} to
* obtain an instance of {@link Vertx}.
* <p>
* A program may integrate a custom {@link VertxInstance}
* with Hibernate Reactive by contributing a new service using a
* {@link org.hibernate.boot.registry.StandardServiceInitiator}
* or from code-based Hibernate configuration by calling
* The default implementation is
* {@link org.hibernate.reactive.vertx.impl.DefaultVertxInstance},
* which creates a new instance of {@code Vertx} if there is no
* instance already associated with the calling thread. This default
* behavior may cause problems in programs which have an instance of
* {@code Vertx} whose lifecycle is managed externally to Hibernate
* Reactive, and in such cases
* {@link org.hibernate.reactive.vertx.impl.ProvidedVertxInstance}
* or a custom-written {@code VertxInstance} should be used.
* <p>
* A program may integrate a custom {@link VertxInstance} with
* Hibernate Reactive by contributing a new service using a
* {@link org.hibernate.boot.registry.StandardServiceInitiator} or
* from code-based Hibernate configuration by calling the method
* {@link org.hibernate.reactive.provider.ReactiveServiceRegistryBuilder#addService}.
*
* <pre>{@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@
* A singleton instance of {@link Vertx} that is created on
* demand and destroyed automatically along with the Hibernate
* {@link org.hibernate.SessionFactory#close() session factory}.
* <p>
* Programs which require Hibernate reactive to use an instance
* of {@code Vertx} whose lifecycle is managed externally to
* Hibernate Reactive should use {@link ProvidedVertxInstance}
* instead.
*
* @author Sanne Grinovero <[email protected]>
* @see ProvidedVertxInstance if you need to a different instance
*
* @see ProvidedVertxInstance
*/
public final class DefaultVertxInstance implements VertxInstance, Stoppable, Startable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* An implementation of {@link VertxInstance} which allows the client
* to provide an instance of {@link Vertx} whose lifecyle is managed
* to provide an instance of {@link Vertx} whose lifecycle is managed
Copy link
Member

@DavideD DavideD Jan 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not part of your changes, but a few lines after this it states:

Hibernate will destroy the {@code Vertx} instance on shutdown.

This is not true though, isn't it?
a ProvidedVertxInstance won't do anything to the Vert.x instance when the factory is closed

Copy link
Member

@DavideD DavideD Jan 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's copied from DefaultVertxInstance, since you are alredy updating this, could you fix this too, please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah, looks wrong.

* externally to Hibernate Reactive. The {@code ProvidedVertxInstance}
* must be registered explicitly with Hibernate by calling
* {@link org.hibernate.reactive.provider.ReactiveServiceRegistryBuilder#addService}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/**
* Integration with Vert.x.
* Integration with Vert.x. Allows a program to customize how
* instances of {@link io.vertx.core.Vertx} should be obtained
* by Hibernate Reactive.
*
* @see org.hibernate.reactive.vertx.VertxInstance
*/
Expand Down