[jboss-dev-forums] [JBoss OSGi Development] - Re: Service integration with MC

thomas.diesler@jboss.com do-not-reply at jboss.com
Fri Nov 20 04:42:23 EST 2009


"adrian" wrote : 
  | The ServiceFactory is just a lazy version of the service. i.e. you only construct it
  | if somebody wants to use it. Its still a singleton. It only controls when the object
  | is constructed (first access instead of upfront).
  | 

Not quite. The main purpose of the ServiceFactory is that every client (bundle) of the service gets its own individual instance of the service. The service implementation may be stateful and maintain state on behalf of the client bundle. If the same bundle gets the service multiple times, it will receive the same service instance. An internal usage count is used to determine when the service can cleanup its state (i.e. when the usage count is 0)

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266702#4266702

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266702



More information about the jboss-dev-forums mailing list