[EMAIL PROTECTED] wrote:
Thanks Richard
It all depends on how isolated you want your instances to be, but one
approach is to modify your bundle to provide a factory for creating
instances of you app
Creating an instance is as easy as instanitating a class (which uses
many many other classes including singletons), but I do need the
instances to be isolated so that the singletons in one instance do not
interfere with or overwrite the singletons in another. Could that work
with your factory solution?
That depends on your implementation details. If your singletons are
static members of some class, probably not, e.g. :
public Foo {
private static Value v;
public static void init(Value v) {
this.v = v;
}
public static Value get() {
return v
}
}
This wouldn't work because everyone would be trying to set and access
the same class statics. However, if your singletons are instances stored
someplace, which is itself an instance, then no problem. This would be
similar to how the OSGi registry works, where a service instance is
created and placed into the service registry for bundles to discover.
If your singleton approach is based on static (generally not a good
idea), then you will need to use class loader isolation, which will
require separate bundles.
-> richard
p.s. Another approach is to create your own Felix launcher. Instead of
installing the same bundle multiple times into one framework instance,
you could create and start different framework instances, installing
your bundle once into each one. Then you don't need to make any
modifications to your bundle. However, they will not be running in the
same framework and won't be able to interact in any way. This would be
pretty easy to implement.
-----Original Message-----
From: Richard S. Hall [mailto:[EMAIL PROTECTED]
Sent: 18 November 2008 14:54
To: [email protected]
Subject: Re: Running multiple instances of one bundle?
It used to be that you could do this by just installing the bundle again
using a different location, but OSGi R4 added the additional requirement
that the symbolic name + version pair must be unique, so this is no
longer possible.
It all depends on how isolated you want your instances to be, but one
approach is to modify your bundle to provide a factory for creating
instances of you app, then you can creating as many instances as you
want.
A hacky approach is to create another copy of your bundle with a
different symbolic name and install two copies.
-> richard
[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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_______________________________________________
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]