+1 for avoiding singletons, we had similar experience with Synapse too, where we had number of singletons on the code (well, *we* have added most of those previously), which permitted us from implementing multi tenancy on the WSO2 stack. Basically it permits more than one configuration being loaded with different parameters. So not just Singletons, we better get rid of the static variables too.
Thanks, Ruwan On Wed, Feb 9, 2011 at 5:53 AM, Daniel Kulp <[email protected]> wrote: > > I'd like to eliminate the singletons in Neethi. With CXF, our general use > case is each application can have it's own set of policies and builders and > such. The singleton pattern Neethi uses makes that impossible. > > The main issue is the PolicyEngine itself. All methods on it are static. > I'd like to make them regular methods. An instance will be required. A > default instance will behave like the current behavior (grab the builders > from > META-INF/services, etc..) but would allow custom configuration and such. > The > major effect is that instead of calling: > PolicyEngine.getPolicy(...) > will need to be rewritten as: > new PolicyEngine().getPolicy(...) > > We could also add a default instance and could do: > > PolicyEngine.getInstance().getPolicy(...) > > to avoid the construction overheads. > > Thoughts? > > -- > Daniel Kulp > [email protected] > http://dankulp.com/blog > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Ruwan Linton Member, Apache Software Foundation; http://www.apache.org Software Architect & Product Manager, WSO2 Inc.; http://wso2.org phone: +1 408 754 7388 ext 51789 email: [email protected]; cell: +94 77 341 3097 blog: http://blog.ruwan.org linkedin: http://www.linkedin.com/in/ruwanlinton google: http://www.google.com/profiles/ruwan.linton tweet: http://twitter.com/ruwanlinton
