File tree 3 files changed +31
-23
lines changed
hibernate-reactive-core/src
main/java/org/hibernate/reactive/service
test/java/org/hibernate/reactive/testing
3 files changed +31
-23
lines changed Original file line number Diff line number Diff line change
1
+ package org .hibernate .reactive .service ;
2
+
3
+ import io .vertx .core .Vertx ;
4
+
5
+ import java .util .Objects ;
6
+
7
+ /**
8
+ * If the framework / container / runtime already has a Vert.x instance which
9
+ * it wants to reuse, use this VertxService implementation to inject it into
10
+ * Hibernate Reactive registry at boot time.
11
+ * When using this service, Hibernate will not reconfigure nor stop the
12
+ * Vert.x instance on shutdown as this responsibility belongs to the
13
+ * code managing it.
14
+ */
15
+ public final class ExternallyProvidedVertxService implements VertxService {
16
+
17
+ private final Vertx vertx ;
18
+
19
+ public ExternallyProvidedVertxService (Vertx vertx ) {
20
+ Objects .requireNonNull ( vertx );
21
+ this .vertx = vertx ;
22
+ }
23
+
24
+ @ Override
25
+ public Vertx getVertx () {
26
+ return vertx ;
27
+ }
28
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
package org .hibernate .reactive .testing ;
2
2
3
3
import io .vertx .core .Vertx ;
4
- import org .hibernate .reactive .service .ManagedVertxService ;
4
+ import org .hibernate .reactive .service .ExternallyProvidedVertxService ;
5
5
import org .hibernate .reactive .service .VertxService ;
6
6
import org .hibernate .service .Service ;
7
7
import org .hibernate .service .ServiceRegistry ;
@@ -35,10 +35,10 @@ public ServiceRegistryImplementor getServiceRegistry() {
35
35
//TODO extract into its own class and evolve as necessary?
36
36
private static class Registry implements ServiceRegistryImplementor {
37
37
38
- private final ManagedVertxService vertxService ;
38
+ private final ExternallyProvidedVertxService vertxService ;
39
39
40
40
public Registry (Vertx vertx ) {
41
- this .vertxService = new ManagedVertxService ( vertx );
41
+ this .vertxService = new ExternallyProvidedVertxService ( vertx );
42
42
}
43
43
44
44
@ Override
You can’t perform that action at this time.
0 commit comments