Anthony

I'm pretty sure this won't fly in terms of a vanilla OSGi - a bundle has 1 state (installed, started etc.) so there's no concept of a bundle itself being runnable multiple times in multiple states.

Now there's nothing to stop you loading the same bundle JAR multiple times - well almost nothing. An OSGi bundle has a "location" - which is the URL it was loaded from. This also uniquely identifies a single bundle - but you can replicate a bundle JAR e.g. by copy, rename, whatever, so it's location is different to other instances of the same bundle JAR.

We do exactly this in our App - in fact we have a "loader bundle" that takes temporary copies with unique names into it's getData() storage and then installs and starts them as discrete bundles. Each gets it's own classloader, as per the OSGi spec, which means that classes that only occur within that bundle and aren't shared via export/import headers, will also then have a "singleton per bundle" i.e. each bundle will see it's own singleton for static classes.

You do need to be careful on things like restarts - since you'll need to make sure your loader bundle can clean up and reload bundles as needed. We avoid this and always "cold load" our OSGi instance, so it isn't an issue for us.

[EMAIL PROTECTED] wrote:
Hi all

Is it possible to run multiple instances of one bundle simultaneously?
The idea here is to use OSGi as a way of running multiple instances, in
one JRE, of a very messy client application that uses lots of singletons
and so on. The multiple instances would be used to load-test a server.
They would differ only in that they would each "log in" to the server
using a different userID, which could be passed in as a parameter or
fetched from a distinct OSGi service.

Thanks,
Anthony
_______________________________________________

This e-mail may contain information that is confidential, privileged or 
otherwise protected from disclosure. If you are not an intended recipient of 
this e-mail, do not duplicate or redistribute it by any means. Please delete it 
and any attachments and notify the sender that you have received it in error. 
Unless specifically indicated, this e-mail is not an offer to buy or sell or a 
solicitation to buy or sell any securities, investment products or other 
financial product or service, an official confirmation of any transaction, or 
an official statement of Barclays. Any views or opinions presented are solely 
those of the author and do not necessarily represent those of Barclays. This 
e-mail is subject to terms available at the following link: 
www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the 
foregoing.  Barclays Capital is the investment banking division of Barclays 
Bank PLC, a company registered in England (number 1026167) with its registered 
office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be 
sent from other members of the Barclays Group.
_______________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--


Ascert - Taking systems to the Edge
[EMAIL PROTECTED]
+44 (0)20 7488 3470
www.ascert.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to