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

PAYARA-3119 NullPointerException when starting Jersey/EJB Containers in Order #3209

Merged
merged 1 commit into from
Sep 28, 2018
Merged
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 @@ -512,6 +512,8 @@ public enum ContainerType {

protected InterceptorManager interceptorManager;

private Set<Object> pendingInterceptors = new HashSet<>();

// the order must be the same as CallbackType and getPre30LifecycleMethodNames
private static final Class[] lifecycleCallbackAnnotationClasses = {
AroundConstruct.class,
Expand Down Expand Up @@ -3446,16 +3448,25 @@ protected String[] getPre30LifecycleMethodNames() {
};
};

private void initializeInterceptorManager() throws Exception {
private synchronized void initializeInterceptorManager() throws Exception {
this.interceptorManager = new InterceptorManager(_logger, this,
lifecycleCallbackAnnotationClasses,
getPre30LifecycleMethodNames());
if (!pendingInterceptors.isEmpty()) {
pendingInterceptors.forEach(this::registerSystemInterceptor);
pendingInterceptors.clear();
}
}

void registerSystemInterceptor(Object o) {

void registerSystemInterceptor(Object interceptor) {
if (needSystemInterceptorProxy()) {
interceptorManager.registerRuntimeInterceptor(o);
synchronized (this) {
if (interceptorManager == null) {
pendingInterceptors.add(interceptor);
} else {
interceptorManager.registerRuntimeInterceptor(interceptor);
}
}
}
}

Expand Down