You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Gurkan Erdogdu (JIRA)" <ji...@apache.org> on 2010/08/20 15:28:15 UTC

[jira] Created: (OWB-444) Using Static Loggers in Shared ClassLoader

Using Static Loggers in Shared ClassLoader
------------------------------------------

                 Key: OWB-444
                 URL: https://issues.apache.org/jira/browse/OWB-444
             Project: OpenWebBeans
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.0.0-alpha-1
            Reporter: Gurkan Erdogdu
            Assignee: Gurkan Erdogdu
             Fix For: 1.0.0-GA


Errors of using static loggers in shared classloaders environments

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-444) Using Static Loggers in Shared ClassLoader

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901032#action_12901032 ] 

Mark Struberg commented on OWB-444:
-----------------------------------

Thought about this already, but I think this would have a huge drawback on our performance. Think about how often we would need to call our WebBeansFinder! If you look at our application with yourkit profiler or a similar tool, then you'd see that we already use WebBeansFinder way too often imo. Otoh, our BeanManager has exactly the right 'slice' (1 per WebApp) for creating and keeping most of our utilities.

> Using Static Loggers in Shared ClassLoader
> ------------------------------------------
>
>                 Key: OWB-444
>                 URL: https://issues.apache.org/jira/browse/OWB-444
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0-alpha-1
>            Reporter: Gurkan Erdogdu
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0-GA
>
>
> Errors of using static loggers in shared classloaders environments

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-444) Using Static Loggers in Shared ClassLoader

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901031#action_12901031 ] 

Gurkan Erdogdu commented on OWB-444:
------------------------------------

I am thinking to change important utility classes to singletons that like others. This is the simplest and correct way without getting into trouble

> Using Static Loggers in Shared ClassLoader
> ------------------------------------------
>
>                 Key: OWB-444
>                 URL: https://issues.apache.org/jira/browse/OWB-444
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0-alpha-1
>            Reporter: Gurkan Erdogdu
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0-GA
>
>
> Errors of using static loggers in shared classloaders environments

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-444) Using Static Loggers in Shared ClassLoader

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901089#action_12901089 ] 

Mark Struberg commented on OWB-444:
-----------------------------------

Maybe my proposal was not yet clear enough: I like to keep those utils as members in BeanManagerImpl (with back-references), so for each WebApp we have exactly 1 BeanManagerImpl. And this has exactly 1 instance of each util. In this case we do not need any singletons anymore. Because our BeanManagerImpl has exactly the one needed (and correctly configured) util class at hand. 

To give you a few numbers: on a large JSF page I originally had more than 1 million WebBeansFinder invocations! Most of them come from our utils which most times need to resolve the BeanManagerImpl... I then at least removed redundant BeanManagerImp.getManager() calls and also removed the doPrivileged and now we are down to ~400.000 invocations. At the end of the day this still costs up to 20% of our performance, so I would not underestimate the effect!

> Using Static Loggers in Shared ClassLoader
> ------------------------------------------
>
>                 Key: OWB-444
>                 URL: https://issues.apache.org/jira/browse/OWB-444
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0-alpha-1
>            Reporter: Gurkan Erdogdu
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0-GA
>
>
> Errors of using static loggers in shared classloaders environments

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-444) Using Static Loggers in Shared ClassLoader

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901085#action_12901085 ] 

Gurkan Erdogdu commented on OWB-444:
------------------------------------

What is the difference to call our singletons from WebBeansFinder over BeanManager ? I wonder how much performance difference between them? Just for curiosity....

> Using Static Loggers in Shared ClassLoader
> ------------------------------------------
>
>                 Key: OWB-444
>                 URL: https://issues.apache.org/jira/browse/OWB-444
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0-alpha-1
>            Reporter: Gurkan Erdogdu
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0-GA
>
>
> Errors of using static loggers in shared classloaders environments

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-444) Using Static Loggers in Shared ClassLoader

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901030#action_12901030 ] 

Gurkan Erdogdu commented on OWB-444:
------------------------------------

I have committed some changes to loggers, (those are not related with Utility or static classes). Those chages are needed because static loggers do not work in shared classloader runtime environments.

As Mark has stated, we have to also change our Utility classes for removing static methods. This is an another side of the story

> Using Static Loggers in Shared ClassLoader
> ------------------------------------------
>
>                 Key: OWB-444
>                 URL: https://issues.apache.org/jira/browse/OWB-444
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0-alpha-1
>            Reporter: Gurkan Erdogdu
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0-GA
>
>
> Errors of using static loggers in shared classloaders environments

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-444) Using Static Loggers in Shared ClassLoader

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901004#action_12901004 ] 

Mark Struberg commented on OWB-444:
-----------------------------------

I think I already commented on removing most of our static util methods because they are also bad from a performance and configuration perspective. I'd suggest to remove 'static' and apply them as members to BeanManager + hold a back reference to the BM.

All those utils then have a ct like

private BeanManagerImpl bm;
public AnnotationUtil(BeanManagerImpl bm)
{
  this.bm = bm;
}

so they can easily access other utils by calling bm.getClassUtil()....

All our Util can then also be modeled as SPI and thus we gain further portability.
I can e.g. imagine a ClassUtil which does all the methods via doPrivileged in SecureClassUtil vs a simple implementation without utilising the SecurityManager in SimpleClassUtil.


> Using Static Loggers in Shared ClassLoader
> ------------------------------------------
>
>                 Key: OWB-444
>                 URL: https://issues.apache.org/jira/browse/OWB-444
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0-alpha-1
>            Reporter: Gurkan Erdogdu
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0-GA
>
>
> Errors of using static loggers in shared classloaders environments

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-444) Using Static Loggers in Shared ClassLoader

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900690#action_12900690 ] 

Gurkan Erdogdu commented on OWB-444:
------------------------------------

This also means that chaning all static methods to normal if they have been using logging heavily. 

For example, one candiate is WebBeansDecoratorConfig class.

> Using Static Loggers in Shared ClassLoader
> ------------------------------------------
>
>                 Key: OWB-444
>                 URL: https://issues.apache.org/jira/browse/OWB-444
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0-alpha-1
>            Reporter: Gurkan Erdogdu
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0-GA
>
>
> Errors of using static loggers in shared classloaders environments

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.