[JIRA] Resolved: (GRIZZLY-1386) OSGiServletHandler.FilterChainImpl isn't threadsafe

  • From: "Ryan Lubke (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [JIRA] Resolved: (GRIZZLY-1386) OSGiServletHandler.FilterChainImpl isn't threadsafe
  • Date: Tue, 22 Jan 2013 21:24:53 +0000 (GMT+00:00)
  • Auto-submitted: auto-generated


     [ 
http://java.net/jira/browse/GRIZZLY-1386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ryan Lubke resolved GRIZZLY-1386.
---------------------------------

    Fix Version/s: 3.0
                   2.3
                   2.2.20
       Resolution: Fixed

> OSGiServletHandler.FilterChainImpl isn't threadsafe
> ---------------------------------------------------
>
>                 Key: GRIZZLY-1386
>                 URL: http://java.net/jira/browse/GRIZZLY-1386
>             Project: grizzly
>          Issue Type: Bug
>          Components: http-service OSGi
>    Affects Versions: 2.2.19
>            Reporter: marens
>            Assignee: Ryan Lubke
>            Priority: Critical
>             Fix For: 3.0, 2.3, 2.2.20
>
>
> OSGiServletHandler has one instance of FilterChainImpl that is used for 
> every Request via ServletHandler.doServletService. This lead to concurrency 
> issues during loadtests.
> This can be prevented by adding the Filters via 
>     /**
>      * Append a filter to the chain of Filters this ServletHandler manages.
>      * 
>      * @param filter Instance of the Filter to add
>      * @param name Name of this Filter to add
>      * @param initParams Initparameters needed to create a FilterConfig
>      */
>     protected void addFilter(final Filter filter, final String name, final 
> Map<String, String> initParams) {
>         try {
>             filter.init(createFilterConfig(getServletCtx(), name, 
> initParams));
>             servletFilters.add(filter);
>         } catch (Exception e) {
>             LOG.error(e.toString(), e);
>         }
>     }
> to a CopyOnWriteArrayList in OSGiServletHandler and 
> returning Filterchains for each request via 
>     @Override
>     protected FilterChainInvoker getFilterChain(Request request) {
>         return filterChainFactory.createFilterChain(servletFilters);
>     }
>     private static final class FilterChainFactory {
>         private final Servlet servlet;
>         private final OSGiServletContext servletContext;
>         /**
>          * Initializes a new {@link FilterChainFactory}.
>          * 
>          * @param servlet
>          * @param servletContext
>          */
>         public FilterChainFactory(Servlet servlet, OSGiServletContext 
> servletContext) {
>             super();
>             this.servlet = servlet;
>             this.servletContext = servletContext;
>         }
>         /**
>          * Construct and return a FilterChain implementation that will wrap 
> the execution of the specified servlet instance. If we should
>          * not execute a filter chain at all, return <code>null</code>.
>          * 
>          * @param request The servlet request we are processing
>          * @param servlet The servlet instance to be wrapped
>          */
>         public FilterChainImpl createFilterChain(List<Filter> 
> servletFilters) {
>             if (servletFilters.isEmpty()) {
>                 return null;
>             }
>             FilterChainImpl filterChain = new FilterChainImpl(servlet, 
> servletContext);
>             for (Filter servletFilter : servletFilters) {
>                 filterChain.addFilter(servletFilter);
>             }
>             return filterChain;
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[JIRA] Resolved: (GRIZZLY-1386) OSGiServletHandler.FilterChainImpl isn't threadsafe

Ryan Lubke (JIRA) 01/22/2013
Terms of Use; Privacy Policy; Copyright ©2013-2017 (revision 20160708.bf2ac18)
 
 
Close
loading
Please Confirm
Close