Skip to content

Commit

Permalink
Merge pull request payara#3209 from jGauravGupta/PAYARA-3119
Browse files Browse the repository at this point in the history
PAYARA-3119 NullPointerException when starting Jersey/EJB Containers in Order
  • Loading branch information
MeroRai authored and Pandrex247 committed Oct 11, 2018
1 parent 90fecf0 commit 3b6f3b5
Showing 1 changed file with 15 additions and 4 deletions.
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

0 comments on commit 3b6f3b5

Please sign in to comment.