[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [equinox-dev] Creating heavy weight DS Components
- From: Simon J Archer <sarcher@xxxxxxxxxx>
- Date: Sat, 30 May 2009 22:52:49 -0500
- Delivered-to: email@example.com
I'm thinking that you could do this
with two DS components in the same bundle. Let's call the first component
BIG, which will reference services that it needs to access to perform its
initialization. The BIG component will not provide any services and
will therefore be implicitly immediate. The other component, let's
call it SMALL will be provide a service, but will be initially disabled
by having its enabled attribute set to "false". Once the
BIG component has completed its initialization it will enable the SMALL
The attached zip contains an example
of how to do this.
I hope this helps,
||Andrew Teirney <andrew@xxxxxxxxxxx>
||05/29/2009 05:48 PM
||[equinox-dev] Creating heavy weight
I currently have several use cases whereby I am using
services to inject dependent services into a component instance, lets
call this component BIG.
The component BIG is intended to provide several services, however
before it can provide the services it needs to be able to utilize
those dependent service for a setup operation that can take some
lengthy amount of time (needs to access several databases/files).
At present I have been trying to do this in the activate method,
however this does have a time limit and if I understand things
correctly if this time is exceeded then the component will be disposed
of if its takes too long to construct.
So, to get around this in the activate method I spawn a thread that
does the processing in the background, and when it completes I
register the services programatically. This thread obviously has to
take into account any of its services being ripped out from underneath
whilst its using it, and the component itself being deactivated.
What I am wondering is whether this is the best possible solution to a
component being a heavyweight service (in that it takes some time to
properly construct). Other than the complexity of the solution another
aspect I don't like is that the services a component provides are not
part of the declarative services xml (a mild annoyance).
If anyone has any tips/pointers on perhaps how to handle this
heavyweight component creation problem I am encountering that would be
equinox-dev mailing list
Description: Zip archive