You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Ivan Krizsan (JIRA)" <de...@tuscany.apache.org> on 2010/02/12 15:44:27 UTC

[jira] Created: (TUSCANY-3464) Invocation of Dynamically Registered Callbacks Gets Stuck without Exception

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


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.


[jira] Commented: (TUSCANY-3464) Invocation of Dynamically Registered Callbacks Gets Stuck without Exception

Posted by "Simon Nash (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12839385#action_12839385 ] 

Simon Nash commented on TUSCANY-3464:
-------------------------------------

The first version of the program doesn't work because of a limitation in SCA.  The SCA assembly model spec defines the wiredByImpl attribute, but the SCA Java specs don't provide any standardized way to use this capability from Java,

The program tries to work around this SCA Java limitation by using Tuscany's Node.getServiceReference() method.  This method returns a service reference which works for forward calls but doesn't support callbacks.  This is consistent with the semantics of the SCAClient interface in the OASIS SCA 1.1 specs, which has the same limitation of not supporting callbacks.

The Node.getServiceReference() method doesn't support callbacks because of the difficulty identifying the SCA component to which the callback should be directed.  (The API doesn't allow any identification of this component to be passed.)  In the test scenario, the calls to the Node.getServiceReference() method are made from the SCAObserverCallback class, which isn't part of any SCA component.  The scenario requires the callback to be made to the ObserverXComponent component from which the forward call through the service reference was made, but this callback component information isn't available to the Tuscany runtime.

To resolve this issue, the SCA API should be extended to provide support for wiredByImpl by adding a capability to dynamically provide a target for an SCA Java reference which includes the ability to make SCA callbacks.  An issue was opened for the wiredBy Impl problem in OASIS (see http://www.osoa.org/jira/browse/JAVA-78) but this issue was closed with no action.

The second version of the program works around this SCA limitation by not using SCA callbacks and instead simulates callback semantics through other means.  This seems a reasonable approach until the underlying SCA limitation is removed.  However the need to make an unnecessary "toString" call in order to make the rest of the scenario work seems like a problem that should be investigated.

It's also a problem that the invalid callback attempt just hangs.  The Tuscany runtime should throw an exception indicating that a callback has been attempted through a dynamically created service reference that doesn't support this capability.

> 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.


[jira] Updated: (TUSCANY-3464) Invocation of Dynamically Registered Callbacks Gets Stuck without Exception

Posted by "Ivan Krizsan (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3464?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan Krizsan updated TUSCANY-3464:
----------------------------------

    Attachment: SCAObserverCallback.zip

Working, but slightly funky, version of my example program.

> 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.


[jira] Updated: (TUSCANY-3464) Invocation of Dynamically Registered Callbacks Gets Stuck without Exception

Posted by "Ivan Krizsan (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3464?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan Krizsan updated TUSCANY-3464:
----------------------------------

    Attachment: SCAObserverCallback.zip

Complete example program which causes the problem to manifest.
Added an additional attempt at invoking callbacks in the ObservableServiceImpl.register method. The original program did not contain this code.

> 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
>
>
> 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.


[jira] Commented: (TUSCANY-3464) Invocation of Dynamically Registered Callbacks Gets Stuck without Exception

Posted by "Ivan Krizsan (JIRA)" <de...@tuscany.apache.org>.
    [ 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.