Skip to content

Commit

Permalink
Merge pull request #25020 from OndroMih/ondromih-hk2-events
Browse files Browse the repository at this point in the history
Use the standard HK2 topic service
  • Loading branch information
dmatej authored Jul 5, 2024
2 parents 123c605 + fcfd6f3 commit a121197
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 117 deletions.
5 changes: 5 additions & 0 deletions appserver/extras/embedded/all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@
<artifactId>hk2-utils</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-extras</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions appserver/extras/embedded/web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
<artifactId>hk2-utils</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-extras</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
import org.glassfish.hk2.api.PostConstruct;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.hk2.api.TypeLiteral;
import org.glassfish.hk2.extras.ExtrasUtilities;
import org.glassfish.hk2.utilities.Binder;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.hk2util.SimpleTopicDistributionService;
import org.glassfish.internal.api.InternalSystemAdministrator;
import org.glassfish.internal.api.ServerContext;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer;
Expand Down Expand Up @@ -142,12 +142,7 @@ private JerseyContainer getJerseyContainer(ResourceConfig config) {
() -> this + ": Creating Jersey container for " + HttpHandler.class + " and " + config);
final GrizzlyHttpContainer httpHandler = ContainerFactory.createContainer(GrizzlyHttpContainer.class, config);
final ServiceLocator jerseyLocator = httpHandler.getApplicationHandler().getInjectionManager().getInstance(ServiceLocator.class);
/*
We enable a temporary distribution service until the HK2 Extras package is fixed so that we can enable
the topic distribution service provided by HK2.
*/
//ExtrasUtilities.enableTopicDistribution(jerseyLocator);
SimpleTopicDistributionService.enable(jerseyLocator);
ExtrasUtilities.enableTopicDistribution(jerseyLocator);
return new JerseyContainer() {
@Override
public void service(Request request, Response response) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
import org.glassfish.hk2.api.PostConstruct;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.hk2.api.TypeLiteral;
import org.glassfish.hk2.extras.ExtrasUtilities;
import org.glassfish.hk2.utilities.Binder;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.hk2util.SimpleTopicDistributionService;
import org.glassfish.internal.api.AdminAccessController;
import org.glassfish.internal.api.RemoteAdminAccessException;
import org.glassfish.internal.api.ServerContext;
Expand Down Expand Up @@ -282,12 +282,7 @@ private JerseyContainer getJerseyContainer(ResourceConfig config) {
() -> this + ": Creating Jersey container for " + HttpHandler.class + " and " + config);
final GrizzlyHttpContainer httpHandler = ContainerFactory.createContainer(GrizzlyHttpContainer.class, config);
final ServiceLocator jerseyLocator = httpHandler.getApplicationHandler().getInjectionManager().getInstance(ServiceLocator.class);
/*
We enable a temporary distribution service until the HK2 Extras package is fixed so that we can enable
the topic distribution service provided by HK2.
*/
//ExtrasUtilities.enableTopicDistribution(jerseyLocator);
SimpleTopicDistributionService.enable(jerseyLocator);
ExtrasUtilities.enableTopicDistribution(jerseyLocator);
return new JerseyContainer() {
@Override
public void service(Request request, Response response) throws Exception {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.glassfish.hk2.api.ServiceLocator;

import java.util.Properties;
import org.glassfish.hk2util.SimpleTopicDistributionService;
import org.glassfish.hk2.extras.ExtrasUtilities;

/**
* @author [email protected]
Expand All @@ -43,8 +43,7 @@ public GlassFishImpl(ModuleStartup gfKernel, ServiceLocator habitat, Properties
We enable a temporary distribution service until the HK2 Extras package is fixed so that we can enable
the topic distribution service provided by HK2.
*/
//ExtrasUtilities.enableTopicDistribution(habitat);
SimpleTopicDistributionService.enable(habitat);
ExtrasUtilities.enableTopicDistribution(habitat);

configure(gfProps);
}
Expand Down

0 comments on commit a121197

Please sign in to comment.