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

SPEC-245: Support embedded EJBContainer #4126

Merged
merged 7 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -191,7 +191,14 @@ protected EJBTimerService() throws Exception {

public static EJBTimerServiceWrapper getEJBTimerServiceWrapper(EJBContextImpl ejbContext) {
if (isNull(persistentTimerService) && isNull(nonPersistentTimerService)) {
throw new IllegalStateException("EJB Timer Service not available");
if (!nonPersistentTimerServiceVerified) {
// this happens when timer service is injected into bean with no timeout methods.
// such constellation is useless, but very present in TCK test cases, so we give it a non-persistent
// timer service
initNonPersistentTimerService(null, true);
} else {
throw new IllegalStateException("EJB Timer Service not available");
}
}
return new EJBTimerServiceWrapper(
persistentTimerService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2689,6 +2689,9 @@ public Object deserializeData(byte[] data) throws Exception {
*/

private void deserializeContext(SessionContextImpl ctx) throws Exception {
if (ctx == null) {
return;
}
Object ejb = ctx.getEJB();
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "StatefulSessionContainer.deserializeData: " + ((ejb == null) ? null : ejb.getClass()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@
<type>zip</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>glassfish-cluster</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>glassfish-common-full</artifactId>
Expand Down Expand Up @@ -302,12 +295,80 @@
<type>zip</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>json</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>javadb</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
<!-- hazelcast package -->
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>hazelcast</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>metro</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>requesttracing</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>

<dependency>
<groupId>fish.payara.packager</groupId>
<artifactId>notification-package</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>

<dependency>
<groupId>fish.payara.packager</groupId>
<artifactId>payara-api-package</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>payara-executor-service</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>cdi-auth-roles</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
<!-- Micro Service -->
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>payara-micro</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
</dependencies>
</project>
3 changes: 0 additions & 3 deletions appserver/packager/requesttracing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,16 @@
<artifactId>requesttracing-package</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>fish.payara.payara-appserver-modules</groupId>
<artifactId>jaxrs-client-tracing</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>fish.payara.payara-appserver-modules</groupId>
<artifactId>opentracing-cdi</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
</project>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@
<artifactId>requesttracing-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
Expand Down Expand Up @@ -315,22 +316,22 @@ public HttpHandler getHttpService() {

@Override
public String getContextRoot() {
return endpointDecider.getContextRoot();
return endpointDecider == null ? null : endpointDecider.getContextRoot();
}

@Override
public int getListenPort() {
return endpointDecider.getListenPort();
return endpointDecider == null ? -1 : endpointDecider.getListenPort();
}

@Override
public InetAddress getListenAddress() {
return endpointDecider.getListenAddress();
return endpointDecider == null ? null : endpointDecider.getListenAddress();
}

@Override
public List<String> getVirtualServers() {
return endpointDecider.getHosts();
return endpointDecider == null ? Collections.emptyList() : endpointDecider.getHosts();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ public void scanArchive(ReadableArchive archive) {
jarSubArchive.close();
}
} catch (Exception ioe) {
Object args[] = { entryName, ioe.getMessage() };
Object args[] = { entryName, ioe };
deplLogger.log(Level.WARNING, JAR_ENTRY_ERROR, args);
}
}
}
} catch (Exception e) {
deplLogger.log(Level.WARNING, FAILED_ANNOTATION_SCAN, e.getMessage());
deplLogger.log(Level.WARNING, FAILED_ANNOTATION_SCAN, e);
}
}
}
20 changes: 5 additions & 15 deletions nucleus/payara-modules/opentracing-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,16 @@
<description>An adapter that implements the OpenTracing API and integrates it with the Request Tracing Service</description>

<dependencies>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-mock</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-util</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency>
<groupId>fish.payara.payara-modules</groupId>
<artifactId>requesttracing-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fish.payara.external</groupId>
<artifactId>opentracing-repackaged</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import org.glassfish.api.event.EventTypes;
import org.glassfish.api.event.Events;
import org.glassfish.internal.api.Globals;
import org.glassfish.internal.deployment.Deployment;
import org.jvnet.hk2.annotations.Optional;
import org.jvnet.hk2.annotations.Service;
import org.jvnet.hk2.config.ConfigBeanProxy;
Expand Down Expand Up @@ -129,7 +130,13 @@ public void postConstruct() {
*/
@Override
public void event(Event event) {
if (event.is(EventTypes.SERVER_SHUTDOWN)) {
if (event.is(Deployment.ALL_APPLICATIONS_LOADED)) {
// there is awkward point in embedded EJBContainer initialization, where same server
// instance is started twice. In such case, we need to reinitialize.
if (threadPoolExecutor.isShutdown()) {
initialiseThreadPools();
}
} else if (event.is(EventTypes.SERVER_SHUTDOWN)) {
threadPoolExecutor.shutdown();
scheduledThreadPoolExecutor.shutdown();
}
Expand Down