Below stack trace indicates that getConfigurationType() is called a lot. It,
however, consults a Hashtable, thereby hitting a synchronized block every
time. Note the resulting wait time (in seconds).

My fix is to cache the value in my WebApplication subclass (and populate
this tiny cache eagerly during app's init()):

    /**
     * caches results because by default wicket consults System properties
(ie
     * hits a synchronized block in hashtable)
     */
    @Override
    public String getConfigurationType()
    {
        // not making this method synchronized because we'll call it during
init
        // to cache the result

        if (configurationTypeCache == null) {
            configurationTypeCache = super.getConfigurationType();
        }
        return configurationTypeCache;
    }

Using 1.4.3


>>
>> Stacks at 7:33
>
>
>>
>> http-8080-15 [BLOCKED] CPU time: 0:04
>
> java.util.Hashtable.get(Object)
>
> java.util.Properties.getProperty(String)
>
> java.lang.System.getProperty(String)
>
> org.apache.wicket.protocol.http.WebApplication.getConfigurationType()
>
> org.apache.wicket.Component.getMarkupId(boolean)
>
> org.apache.wicket.Component.getMarkupId()
>
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getPreconditionScript()
>
>
>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.generateCallbackScript(CharSequence)
>
>
>> org.apache.wicket.ajax.AjaxEventBehavior.generateCallbackScript(CharSequence)
>
>
>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getCallbackScript(boolean)
>
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getCallbackScript()
>
> org.apache.wicket.ajax.AjaxEventBehavior.getEventHandler()
>
> org.apache.wicket.ajax.AjaxEventBehavior.onComponentTag(ComponentTag)
>
> org.apache.wicket.behavior.AbstractAjaxBehavior.onComponentTag(Component,
>> ComponentTag)
>
> org.apache.wicket.Component.renderComponentTag(ComponentTag)
>
> org.apache.wicket.Component.renderComponent(MarkupStream)
>
> org.apache.wicket.MarkupContainer.onRender(MarkupStream)
>
> org.apache.wicket.Component.render(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderNext(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.MarkupContainer.renderAssociatedMarkup(String, String)
>
> org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.Component.renderComponent(MarkupStream)
>
> org.apache.wicket.MarkupContainer.onRender(MarkupStream)
>
> org.apache.wicket.Component.render(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderNext(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.Component.renderComponent(MarkupStream)
>
> org.apache.wicket.MarkupContainer.onRender(MarkupStream)
>
> org.apache.wicket.Component.render(MarkupStream)
>
> org.apache.wicket.markup.repeater.AbstractRepeater.renderChild(Component)
>
> org.apache.wicket.markup.repeater.AbstractRepeater.onRender(MarkupStream)
>
> org.apache.wicket.Component.render(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderNext(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.MarkupContainer.renderAssociatedMarkup(String, String)
>
> org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.Component.renderComponent(MarkupStream)
>
> org.apache.wicket.MarkupContainer.onRender(MarkupStream)
>
> org.apache.wicket.Component.render(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderNext(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.Component.renderComponent(MarkupStream)
>
> org.apache.wicket.MarkupContainer.onRender(MarkupStream)
>
> org.apache.wicket.Component.render(MarkupStream)
>
> org.apache.wicket.MarkupContainer.autoAdd(Component, MarkupStream)
>
> org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupContainer,
>> MarkupStream, ComponentTag)
>
> org.apache.wicket.markup.resolver.ComponentResolvers.resolve(Application,
>> MarkupContainer, MarkupStream, ComponentTag)
>
> org.apache.wicket.MarkupContainer.renderNext(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupStream,
>> ComponentTag)
>
> org.apache.wicket.Component.renderComponent(MarkupStream)
>
> org.apache.wicket.MarkupContainer.onRender(MarkupStream)
>
> org.apache.wicket.Component.render(MarkupStream)
>
> org.apache.wicket.MarkupContainer.autoAdd(Component, MarkupStream)
>
> org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupContainer,
>> MarkupStream, ComponentTag)
>
> org.apache.wicket.markup.resolver.ComponentResolvers.resolve(Application,
>> MarkupContainer, MarkupStream, ComponentTag)
>
> org.apache.wicket.MarkupContainer.renderNext(MarkupStream)
>
> org.apache.wicket.MarkupContainer.renderAll(MarkupStream)
>
> org.apache.wicket.Page.onRender(MarkupStream)
>
> org.apache.wicket.Component.render(MarkupStream)
>
> org.apache.wicket.Page.renderPage()
>
>
>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(RequestCycle)
>
>
>> org.apache.wicket.request.target.coding.HybridUrlCodingStrategy$HybridBookmarkablePageRequestTarget.respond(RequestCycle)
>
>
>> org.apache.wicket.request.AbstractRequestCycleProcessor.respond(RequestCycle)
>
> org.apache.wicket.RequestCycle.processEventsAndRespond()
>
> org.apache.wicket.RequestCycle.step()
>
> org.apache.wicket.RequestCycle.steps()
>
> org.apache.wicket.RequestCycle.request()
>
> org.apache.wicket.protocol.http.WicketFilter.doGet(HttpServletRequest,
>> HttpServletResponse)
>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(ServletRequest,
>> ServletResponse, FilterChain)
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest,
>> ServletResponse)
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest,
>> ServletResponse)
>
> org.apache.catalina.core.StandardWrapperValve.invoke(Request, Response)
>
> org.apache.catalina.core.StandardContextValve.invoke(Request, Response)
>
> org.apache.catalina.core.StandardHostValve.invoke(Request, Response)
>
> org.apache.catalina.valves.ErrorReportValve.invoke(Request, Response)
>
> org.apache.catalina.valves.AccessLogValve.invoke(Request, Response)
>
> org.apache.catalina.core.StandardEngineValve.invoke(Request, Response)
>
> org.apache.catalina.connector.CoyoteAdapter.service(Request, Response)
>
> org.apache.coyote.http11.Http11Processor.process(Socket)
>
>
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Socket)
>
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run()
>
> java.lang.Thread.run()
>
>
>>
>> --
---------------------------------------------------
Nikita Tovstoles
cell: +1-650-996-8173
---------------------------------------------------

Reply via email to