[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [equinox-dev] Creating heavy weight DS Components
|
Andrew,
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
component.
The attached zip contains an example
of how to do this.
I hope this helps,
Simon
From:
| Andrew Teirney <andrew@xxxxxxxxxxx>
|
To:
| equinox-dev@xxxxxxxxxxx
|
Date:
| 05/29/2009 05:48 PM
|
Subject:
| [equinox-dev] Creating heavy weight
DS Components
|
Sent by:
| equinox-dev-bounces@xxxxxxxxxxx |
I currently have several use cases whereby I am using
declarative
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
appreciated.
CU,
Andrew
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
Attachment:
BigAndSmall.zip
Description: Zip archive