[ 
https://issues.apache.org/jira/browse/TUSCANY-3464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838841#action_12838841
 ] 

Ivan Krizsan commented on TUSCANY-3464:
---------------------------------------

I finally managed to make my program work as I originally wanted it.
I wouldn't say that this is a solution, but rather a workaround - take a look 
at the method in which an observer registers with an observable. In order to 
establish the wiring so that callbacks can later be made, the observable MUST 
call a method, any method, on the observer.


> Invocation of Dynamically Registered Callbacks Gets Stuck without Exception
> ---------------------------------------------------------------------------
>
>                 Key: TUSCANY-3464
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3464
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>    Affects Versions: Java-SCA-2.0-M3
>         Environment: Mac OS X 10.5 and 10.6, JavaSE 1.6, Apache Tuscany 2.0M4 
> and also a recent nightly build.
>            Reporter: Ivan Krizsan
>         Attachments: SCAObserverCallback.zip, SCAObserverCallback.zip
>
>
> Further explorations of callbacks in Tuscany 2.0M4. I have the following 
> scenario:
> - Two Observer SCA components.
> Each component has a reference to an Observable component with the 
> wiredByImpl="true".
> - One Observable SCA component.
> This component has a callback with the interface of the Observer component as 
> parameter, but no callback is injected in the component.
> To register for notifications, an Observer calls register on anObservable, 
> without any parameters.
> In the Observable, a callback service reference is retrieved like this:
> ServiceReference<ObserverService> theObserverRef = 
> mRequestContext.getCallbackReference();
> This service reference is stored and later, when a periodic task is run, an 
> attempt is made to call all the Observer components that have registered with 
> the Observable, like this:
> for (ServiceReference<ObserverService> theObserverRef : mObservers.values())
> {
>     theObserverRef.getService().notify("" + theCurrentTime);
> }
> This fails - the call to notify never returns and there are no error messages 
> or exceptions in the log.
> If I try to call the callback when it registers, there is an exception and a 
> complaint about "No callback wire found".
> Is it possible to use callbacks in the way described above?
> Service Component Architecture SCA-J Common Annotations and APIs
> Specification, version 1.1, in section 7.2.4 says:
> "Because ServiceReference objects are serializable, they can be stored
> persistently and retrieved at
> a later time to make a callback invocation after the associated service
> request has completed."
> ...so I was lead to believe that my scenario would be possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to