[GLASSFISH-19292] [osgi/cdi] implement BundleScope Created: 06/Nov/12 Updated: 12/Nov/12
|Reporter:||Sanjeeb Sahoo||Assignee:||Sanjeeb Sahoo|
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
OSGi services have two scopes:
We should create a CDI scope called BundleScope to match the later type.
|Comment by TangYong [ 07/Nov/12 ]|
I want to make a discussion of concrete means for the feature.
1 About the scopes of "singleton and per bundle"
My understanding is, for OSGi Service Spec, there are two ways to register service.
1) using service implementation directly
In this case, service consumer will get the same service implementation object instance, called "singleton pattern for object creation"
2) using service factory
In this case, service consumer will get multi service implementation object instance, called "prototype pattern for object creation"
So, backing the feature,
2 About "create a CDI scope called BundleScope"
1) Creating/Design way
Question: whether you agree with me or not?
2) Question: whether not needing to create singleton scope and defaultly, if not specifying BundleScope, the scope is singleton scope?
3 About singleton service object
・using java reflection
・using CDI's Instance<T>.select().get()
・using CDI's contextual instance
Question: Which one can be better?
4 about a user's using way
Question: whether we should consider the case as user's error or not?
|Comment by Sanjeeb Sahoo [ 07/Nov/12 ]|
When service is directly bound, its singleton scope. When factory is bound, then it's scope is bundle scope. I hope this answers your first question.
I have not thought about the design yet. I think we need to first implement GLASSFISH-19215 before embarking upon this feature.
|Comment by TangYong [ 12/Nov/12 ]|
>When service is directly bound, its singleton scope. When factory is bound, then it's scope is bundle scope. I hope >this answers your first question.
>I have not thought about the design yet. I think we need to first implement GLASSFISH-19215 before embarking upon >this feature.
OK. I see.
>3 About singleton service object