-1, there is no doc in there and we dont expose the javadoc and it is actually wrong:
+ /** + * Auto initialization class for servers supporting + * the {@link ServletContainerInitializer} + */ This is actually not the case, it is just implicit setup of OWB. Maybe we should add a word in the doc about btw more than the code since it is a setup thing and not a dev thing in most cases. Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> ---------- Forwarded message --------- De : <gerdo...@apache.org> Date: ven. 5 juin 2020 à 11:40 Subject: [openwebbeans] branch master updated: adding comments and cosmetic changes To: comm...@openwebbeans.apache.org <comm...@openwebbeans.apache.org> This is an automated email from the ASF dual-hosted git repository. gerdogdu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openwebbeans.git The following commit(s) were added to refs/heads/master by this push: new c2b0738 adding comments and cosmetic changes c2b0738 is described below commit c2b07386e2bd9a702a4fab07696e1a0cdcb792c7 Author: Gurkan Erdogdu <cgurkanerdo...@gmail.com> AuthorDate: Fri Jun 5 12:39:50 2020 +0300 adding comments and cosmetic changes --- .../se/DefaultApplicationBoundaryService.java | 25 ++++++++++++++++++++-- .../apache/webbeans/spi/DefiningClassService.java | 17 ++++++++------- .../servlet/WebBeansConfigurationListener.java | 22 +++++++++++++++++++ 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java b/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java index c2e9295..9c39d69 100644 --- a/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java +++ b/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java @@ -45,15 +45,22 @@ public class DefaultApplicationBoundaryService implements ApplicationBoundarySer */ private Set<ClassLoader> parentClassLoaders; + /** + * Contructs a new {@link DefaultApplicationBoundaryService} + */ public DefaultApplicationBoundaryService() { init(); } + /** + * Initialise the instance. + */ protected void init() { applicationClassLoader = BeanManagerImpl.class.getClassLoader(); parentClassLoaders = new HashSet<>(); + ClassLoader cl = applicationClassLoader; while (cl.getParent() != null) { @@ -63,12 +70,18 @@ public class DefaultApplicationBoundaryService implements ApplicationBoundarySer } + /** + * {@inheritDoc} + */ @Override public ClassLoader getApplicationClassLoader() { return applicationClassLoader; } + /** + * {@inheritDoc} + */ @Override public ClassLoader getBoundaryClassLoader(Class classToProxy) { @@ -99,12 +112,20 @@ public class DefaultApplicationBoundaryService implements ApplicationBoundarySer return classToProxyCl; } - protected boolean isOutsideOfApplicationClassLoader(ClassLoader classToProxyCl) + /** + * + * @param classToProxyClassLoader + * @return + */ + protected boolean isOutsideOfApplicationClassLoader(ClassLoader classToProxyClassLoader) { - return parentClassLoaders.contains(classToProxyCl); + return parentClassLoaders.contains(classToProxyClassLoader); } + /** + * {@inheritDoc} + */ @Override public void close() throws IOException { diff --git a/webbeans-spi/src/main/java/org/apache/webbeans/spi/DefiningClassService.java b/webbeans-spi/src/main/java/org/apache/webbeans/spi/DefiningClassService.java index da642ac..3bda2cd 100644 --- a/webbeans-spi/src/main/java/org/apache/webbeans/spi/DefiningClassService.java +++ b/webbeans-spi/src/main/java/org/apache/webbeans/spi/DefiningClassService.java @@ -19,24 +19,25 @@ package org.apache.webbeans.spi; /** - * a SPI implementing the proxy defining logic. + * SPI interface to implement the proxy defining logic. * It enables to switch from unsafe to classloader logic for instance for java >= 9. */ public interface DefiningClassService { /** - * @param forClass the proxied class. - * @return the classloader to use to define the class. + * Returns the classloader to use to define the given class. + * @param forClass the proxied class + * @return the classloader to use to define the class */ ClassLoader getProxyClassLoader(Class<?> forClass); /** * Register the proxy class from its bytecode. - * @param name the proxy name. - * @param bytecode the bytecode to "define". - * @param proxiedClass the original class. - * @param <T> type of the class to proxy. - * @return the proxy class. + * @param name the proxy name + * @param bytecode the bytecode to "define" + * @param proxiedClass the original class + * @param <T> type of the class to proxy + * @return the proxy class */ <T> Class<T> defineAndLoad(String name, byte[] bytecode, Class<T> proxiedClass); } diff --git a/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java b/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java index b6d56d6..bd59e99 100644 --- a/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java +++ b/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java @@ -58,13 +58,17 @@ import java.util.logging.Logger; */ public class WebBeansConfigurationListener implements ServletContextListener, ServletRequestListener, HttpSessionListener { + /**Logger instance*/ private static final Logger logger = WebBeansLoggerFacade.getLogger(WebBeansConfigurationListener.class); /**Manages the container lifecycle*/ protected ContainerLifecycle lifeCycle; + /**Application {@link WebBeansContext} instance*/ private WebBeansContext webBeansContext; + + /**Application {@link ContextsService}*/ private ContextsService contextsService; /** @@ -193,6 +197,10 @@ public class WebBeansConfigurationListener implements ServletContextListener, Se } } + /** + * Initializing logic for initializing the context. + * @param event {@link ServletContextEvent} + */ private void doStart(final ServletContextEvent event) { if (event.getServletContext().getAttribute(getClass().getName()) != null) @@ -217,6 +225,11 @@ public class WebBeansConfigurationListener implements ServletContextListener, Se } } + /** + * Returns true if the request must be destroyed false otherwise. + * Ensure that we have a {@link RequestScoped} context. + * @return true if the request must be destroyed false otherwise + */ private boolean ensureRequestScope() { Context context = this.lifeCycle.getContextService().getCurrentContext(RequestScoped.class); @@ -241,16 +254,25 @@ public class WebBeansConfigurationListener implements ServletContextListener, Se } } + /** + * Auto initialization class for servers supporting + * the {@link ServletContainerInitializer} + */ public static class Auto implements ServletContainerInitializer { + /** + * {@inheritDoc} + */ @Override public void onStartup(final Set<Class<?>> set, final ServletContext servletContext) { final String key = "openwebbeans.web.sci.active"; + if (!Boolean.parseBoolean(System.getProperty(key, servletContext.getInitParameter(key)))) { return; } + final WebBeansConfigurationListener listener = new WebBeansConfigurationListener(); listener.doStart(new ServletContextEvent(servletContext)); servletContext.addListener(listener);