[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[equinox-dev] Creating heavy weight DS Components
- From: Andrew Teirney <andrew@xxxxxxxxxxx>
- Date: Sat, 30 May 2009 09:48:14 +1200
- Delivered-to: email@example.com
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=SdSuRaobcabx5zeCEWCGQ/5JOh/rWAj/XOEotaFFMghMPh7qvqoP+rdng4xNw2e5y7 zmXUnxgFvlUaseCA7mu0Pv13rAEVRCaw9aOE2NGO3bTRb3wWeoc1kIBSTdYAxm64Pi2U kEeOO4WObvREq5VfzM03go7sGWu+dW+ZoFFDs=
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