Re: [osgi-dev] [DS] ComponentFactory.newInstance with a dynamic property

2010-06-15 Thread Felix Meschberger
Hi,

On 14.06.2010 18:13, Sangjin Lee wrote:
 Thanks. With the equinox DS (1.1.1.R35x_v20090806), however, I do get a
 ComponentException saying that it is unable to resolve a service
 instance (haven't tried felix yet).
 
 I have a complete proof-of-concept example that shows what I'm trying to
 do, and hopefully you'd be able to see for yourself: http://bit.ly/dhnyfK.
 

Thanks for the sample, which I quickly tested on Felix DS trunk, and to
my surprise ;-) it worked  (It doesn't seem to work on the latest
release, though).

Regards
Felix

 Thanks!
 
 Sangjin
 
 
 On Mon, Jun 14, 2010 at 6:42 AM, BJ Hargrave hargr...@us.ibm.com
 mailto:hargr...@us.ibm.com wrote:
 
 I don't see why this should not work. All you can do is refine one
 of the target reference which must exist for the ComponentFactory to
 be satisfied. So a service.target property passed to newInstance can
 further refine the bound reference.
 
 It may be that the current implementations do not handle this, but
 from a spec point of view, it should be supported.
 -- 
 
 *BJ Hargrave*
 Senior Technical Staff Member, IBM
 OSGi Fellow and CTO of the _OSGi Alliance_ http://www.osgi.org/_
 __hargr...@us.ibm.com_ mailto:hargr...@us.ibm.com   
 
 office: +1 386 848 1781
 mobile: +1 386 848 3788
 
 
 
 
 
 
 
 From:Sangjin Lee sj...@apache.org mailto:sj...@apache.org
 To:OSGi Developer Mail List osgi-dev@mail.osgi.org
 mailto:osgi-dev@mail.osgi.org
 Date:2010/06/10 14:01
 Subject:[osgi-dev] [DS] ComponentFactory.newInstance with a
 dynamic property
 Sent by:osgi-dev-boun...@mail.osgi.org
 mailto:osgi-dev-boun...@mail.osgi.org
 
 
 
 
 I have a question on the behavior of ComponentFactory.newInstance()
 when you inject a reference target dynamically.
 
 I have a factory component that has a unary mandatory reference to
 some service, but the target is intentionally left blank (so I can
 provide it dynamically). When I instantiate a specific instance, I
 want to pass in a particular type so this specific instance can bind
 to the right service instance. The code snippet is
 at _http://bit.ly/dy8kFy_.
 
 I am basically adding a property for service.target =
 (type=foo), so at runtime this binds specifically to a service
 instance of type=foo. Will this pattern work? Also, if so, how does
 ComponentFactory.newInstance() behave if that service is not
 registered yet? Will it fail immediately or will it block/wait until
 that particular service is registered?
 
 In a bigger context, I'm trying to see if I can use this pattern as
 a way to compel a specific service with a type dynamically at
 runtime. Is there a better pattern to compel a specific service type
 dynamically? Thanks much!
 
 Regards,
 Sangjin___
 
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org mailto:osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev
 
 
 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org mailto:osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev
 
 
 
 
 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev


[osgi-dev] How to get runtime Memory Usage for an OSGi bundle..?

2010-06-15 Thread Ashish Billore1

Hello Everyone,

I am working on optimization and performance tuning of an OSGi based
server application (uses customized Equinox as runtime and has OSGi bundles
and headless Eclipse Plugins as building block). For this, I need to get
the profiling data about OSGi bundles and plugins running in the
application. So, is there any command or utility which can give me memory
footprint of a given bundle/plugin?

Some command like:

osgimemusage bundle_id

I tried using some of the profilers out there (Eclipse TPTP) etc, however,
they have problems like:
- Too heavy, they introduce their own overheads and most of the time the
app jvm crashes (due to out-of-memory errors or problem with the remote
agent).
- Give very low level profiling info (i.e. gives info about java classes
and application class level info) however, I am more interested in knowing
these details at the bundle level.

Thanks for the help.

Best Regards,
Ashish Billore

___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev


Re: [osgi-dev] How to get runtime Memory Usage for an OSGi bundle..?

2010-06-15 Thread Jeff McAffer
At one point in the past we (Equinox team) had connections to the IBM J9 JVM 
that could tell you about the space taken for each bundle wrt *classes* and 
literals. The Eclipse Core Tools [0] still have that support in but I doubt 
that the VM side still works.  Also in the past (and perhaps still) the J9 guys 
worked on Resource Managed (RM) support that allowed for tracking and control 
of heap memory usage on a per classloader (e.g., bundle) basis.  I don't know 
the status of this work.

Jeff

[0] http://wiki.eclipse.org/Core_Tools

On 2010-06-15, at 7:57 AM, BJ Hargrave wrote:

 I don't know of such a command and I am not sure one can be properly written. 
 There is no way to properly assign a memory object to a specific bundle. 
 For example, which bundle should be the owner of a HashMap object? No matter 
 what rules you construct to decide this, there is a reasonable case in which 
 your rule is wrong. 
 --
 BJ Hargrave
 Senior Technical Staff Member, IBM
 OSGi Fellow and CTO of the OSGi Alliance
 hargr...@us.ibm.com   
 
 office: +1 386 848 1781
 mobile: +1 386 848 3788
 
 
 
 
 
 
 From:Ashish Billore1 ashish.billo...@in.ibm.com 
 To:osgi-dev@mail.osgi.org 
 Date:2010/06/15 07:36 
 Subject:[osgi-dev] How to get runtime Memory Usage for an OSGi 
 bundle..? 
 Sent by:osgi-dev-boun...@mail.osgi.org 
 
 
 
 
 Hello Everyone,
 
 I am working on optimization and performance tuning of an 
 OSGi based
 server application (uses customized Equinox as runtime and has OSGi bundles
 and headless Eclipse Plugins as building block). For this, I need to get
 the profiling data about OSGi bundles and plugins running in the
 application. So, is there any command or utility which can give me memory
 footprint of a given bundle/plugin?
 
 Some command like:
 
 osgimemusage bundle_id
 
 I tried using some of the profilers out there (Eclipse TPTP) etc, however,
 they have problems like:
 - Too heavy, they introduce their own overheads and most of the time the
 app jvm crashes (due to out-of-memory errors or problem with the remote
 agent).
 - Give very low level profiling info (i.e. gives info about java classes
 and application class level info) however, I am more interested in knowing
 these details at the bundle level.
 
 Thanks for the help.
 
 Best Regards,
 Ashish Billore
 
 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev
 
 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev

___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] How to get runtime Memory Usage for an OSGi bundle..?

2010-06-15 Thread Mirko Jahn
Well, you can use the JVMTI interface of the JVM in order to build your own
analysis agent. Unfortunately this means writing native C/C++ code, but if
you feel the need - it might be worth the effort.

Mirko

On Tue, Jun 15, 2010 at 4:23 PM, Jeff McAffer j...@eclipsesource.comwrote:

 At one point in the past we (Equinox team) had connections to the IBM J9
 JVM that could tell you about the space taken for each bundle wrt *classes*
 and literals. The Eclipse Core Tools [0] still have that support in but I
 doubt that the VM side still works.  Also in the past (and perhaps still)
 the J9 guys worked on Resource Managed (RM) support that allowed for
 tracking and control of heap memory usage on a per classloader (e.g.,
 bundle) basis.  I don't know the status of this work.

 Jeff

 [0] http://wiki.eclipse.org/Core_Tools


 On 2010-06-15, at 7:57 AM, BJ Hargrave wrote:

 I don't know of such a command and I am not sure one can be properly
 written. There is no way to properly assign a memory object to a specific
 bundle. For example, which bundle should be the owner of a HashMap object?
 No matter what rules you construct to decide this, there is a reasonable
 case in which your rule is wrong.
 --

  *BJ Hargrave*
 Senior Technical Staff Member, IBM
 OSGi Fellow and CTO of the *OSGi Alliance* http://www.osgi.org/*
 **hargr...@us.ibm.com* hargr...@us.ibm.com

 office: +1 386 848 1781
 mobile: +1 386 848 3788






 From:Ashish Billore1 ashish.billo...@in.ibm.com
 To:osgi-dev@mail.osgi.org
 Date:2010/06/15 07:36
 Subject:[osgi-dev] How to get runtime Memory Usage for an OSGi
 bundle..?
 Sent by:osgi-dev-boun...@mail.osgi.org

 --




 Hello Everyone,

 I am working on optimization and performance tuning of an
 OSGi based
 server application (uses customized Equinox as runtime and has OSGi bundles
 and headless Eclipse Plugins as building block). For this, I need to get
 the profiling data about OSGi bundles and plugins running in the
 application. So, is there any command or utility which can give me memory
 footprint of a given bundle/plugin?

 Some command like:

 osgimemusage bundle_id

 I tried using some of the profilers out there (Eclipse TPTP) etc, however,
 they have problems like:
 - Too heavy, they introduce their own overheads and most of the time the
 app jvm crashes (due to out-of-memory errors or problem with the remote
 agent).
 - Give very low level profiling info (i.e. gives info about java classes
 and application class level info) however, I am more interested in knowing
 these details at the bundle level.

 Thanks for the help.

 Best Regards,
 Ashish Billore

 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev

 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev



 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev

___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] [DS] ComponentFactory.newInstance with a dynamic property

2010-06-15 Thread Agemo Cui
I don't know whether the service.target property can be taken from the
configuration created by ConfigurationAdmin.
If yes, you may create a component by creating a factory configuration. But
that component should be declared as immediate/delay component instead of
factory component.

Regards,
Agemo

On Tue, Jun 15, 2010 at 3:33 PM, Sangjin Lee sj...@apache.org wrote:

 What I am suspecting is that this might be an issue of timing. If I
 understood the specification correctly, ComponentFactory.newInstance() will
 try to satisfy the constraints when invoked, and if it is unable to do so it
 *at that time* it will throw a ComponentException. I think it follows then
 that this is not a blocking call. If there is no service that can satisfy
 the binding at the time of invocation, the call will fail fast. Is this
 understanding correct? Then I don't think this can be made to work.

 What I was hoping for is a way to produce a component definition
 dynamically so they can stay unsatisfied until the service they're looking
 for comes online.

 Regards,
 Sangjin


 On Mon, Jun 14, 2010 at 9:13 AM, Sangjin Lee sjl...@gmail.com wrote:

 Thanks. With the equinox DS (1.1.1.R35x_v20090806), however, I do get a
 ComponentException saying that it is unable to resolve a service instance
 (haven't tried felix yet).

 I have a complete proof-of-concept example that shows what I'm trying to
 do, and hopefully you'd be able to see for yourself: http://bit.ly/dhnyfK
 .

 Thanks!

 Sangjin


 On Mon, Jun 14, 2010 at 6:42 AM, BJ Hargrave hargr...@us.ibm.com wrote:

 I don't see why this should not work. All you can do is refine one of the
 target reference which must exist for the ComponentFactory to be satisfied.
 So a service.target property passed to newInstance can further refine the
 bound reference.

 It may be that the current implementations do not handle this, but from a
 spec point of view, it should be supported.
 --

  *BJ Hargrave*
 Senior Technical Staff Member, IBM
 OSGi Fellow and CTO of the *OSGi Alliance* http://www.osgi.org/*
 **hargr...@us.ibm.com* hargr...@us.ibm.com

 office: +1 386 848 1781
 mobile: +1 386 848 3788






 From:Sangjin Lee sj...@apache.org
 To:OSGi Developer Mail List osgi-dev@mail.osgi.org
 Date:2010/06/10 14:01
 Subject:[osgi-dev] [DS] ComponentFactory.newInstance with a
 dynamic property
 Sent by:osgi-dev-boun...@mail.osgi.org
 --



 I have a question on the behavior of ComponentFactory.newInstance() when
 you inject a reference target dynamically.

 I have a factory component that has a unary mandatory reference to some
 service, but the target is intentionally left blank (so I can provide it
 dynamically). When I instantiate a specific instance, I want to pass in a
 particular type so this specific instance can bind to the right service
 instance. The code snippet is at 
 *http://bit.ly/dy8kFy*http://bit.ly/dy8kFy
 .

 I am basically adding a property for service.target = (type=foo), so
 at runtime this binds specifically to a service instance of type=foo. Will
 this pattern work? Also, if so, how does ComponentFactory.newInstance()
 behave if that service is not registered yet? Will it fail immediately or
 will it block/wait until that particular service is registered?

 In a bigger context, I'm trying to see if I can use this pattern as a way
 to compel a specific service with a type dynamically at runtime. Is there
 a better pattern to compel a specific service type dynamically? Thanks much!

 Regards,
 Sangjin___

 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev


 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev




 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev

___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev