Hi Simon/Raymond,

 

Raymond's comment on the SCA specification not being clear on whether the
@Init method can use injected references is correct. We have discussed this
but have not come to a conclusion yet.

 

The OASIS Open issue for this problem is
http://www.osoa.org/jira/browse/JAVA-65 which talks about lifecycle.

 

I have written a proposal for this issue which can be found at:

 

http://lists.oasis-open.org/archives/sca-j/200811/msg00095.html

 

NOTE: This proposal has not been accepted and is likely to change before it
is included as part of the SCA specification.

 

The proposal says that you cannot use injected references in @Init and a new
@PostInit annotation would be added to allow injected references to be used.
The review comments so far have said that this is too complex and should be
simplified so the @PostInit annotation may be removed.

 

By an interesting coincidence, this issue is on the agenda for the SCA-J
virtual Face to Face meeting and is likely to be discussed today (Tuesday)
or Friday.

 

I'll keep you posted as to what happens.

 

Thanks,

 

Mark

 

  _____  

From: Raymond Feng [mailto:[email protected]] 
Sent: 02 February 2009 19:02
To: [email protected]
Subject: Re: [2.x] [DISCUSS] calling references from withing @Init methods

 

Hi,

 

1) I agree with Simon that the SCA spec is not clear whether a method with
@Init can call other services. IMO, it's probably not safe to do so no
matter how the SCA runtime controls the ordering of "start". For example, we
could have two composite-scoped components, the 1st one tries to invoke the
2nd one within the init method. Then we need to make sure 2nd component is
started before the 1st one. We should raise this issue to the spec group.

 

2) For each component, the following order probably makes more sense:

 

a) reference (Get external dependencies ready ...)

b) implementation provider (Get the implementation ready ...)

c) scoped implementation (Init the instance within the scope ...)

d) service (Start to provide services to other components ...)

 

Thanks,

Raymond


 

From: Simon <mailto:[email protected]>  Laws 

Sent: Monday, February 02, 2009 9:04 AM

To: tuscany-dev <mailto:[email protected]>  

Subject: [2.x] [DISCUSS] calling references from withing @Init methods

 

Raymond had to adjust the binding-ws-calculator test case where we are
calling references from within an @Init method which was deadlocking. In
this case the reference/service interface is over web services. The problem
is that the CompositeActivator is written so that each component is started
completely and one after another and hence target service bindings are not
necessarily active when the first @Init is run, e.g. in
CompositeActivator.start(Component component)...

For each component
  start reference provider
  start service provider
  start implementation provider
  start scoped component - Whic in turn calls @Init method

Which I think should be 

For each component
  start reference provider
  start service provider
  start implementation provider

For each component
  start scoped component

In order that all the implementations and reference/service bindings are
started before any @Init methods run. 

I'm saying this based on the assumption that it's valid to call injected
references from within methods marked as @Init. The Java common annotations
and APIs say's that @Init must be called after injection is complete. It
doesn't explcitly say that you can use the injected references but I don't
see how you can stop developers doing this if injection is complete. 

Simon

Reply via email to