SCA component invoking a callback from a separate thread
Hi, I am trying to write an SCA component that invokes a callback asynchronously (see code at the bottom of this message). In order to simulate an asynchronous notification, a new thread is created and the callback is invoked from within that thread. When I execute the application it throws the following exception: Exception in thread Thread-0 java.lang.AssertionError: Missing stack of from addresses at org.apache.tuscany.core.wire.jdk.JDKCallbackInvocationHandler.invoke(JDK CallbackInvocationHandler.java:61) at $Proxy17.done(Unknown Source) at test.Component2$1.run(Component2.java:32) at java.lang.Thread.run(Unknown Source) I suspect that the context required for the callback to work is not available from the new thread. My question is: is there a way for my component to invoke a callback from a different thread? If so, how can it be done? Thanks for your help, sample code @Service(ComponentService.class) public class Component implements ComponentService { private ComponentServiceCallback m_Callback; public Component() { } @Callback public void setCallback(ComponentServiceCallback a_Callback) { m_Callback = a_Callback; } public void run() { Runnable exec = new Runnable() { public void run() { m_Callback.done(); } }; new Thread(exec).start(); } } /sample code - Martin Leclerc Technical Architect Ubiquity Software www.ubiquitysoftware.com BLOCKED::http://www.ubiquitysoftware.com Phone: (613) 271-2027 Email: [EMAIL PROTECTED] BLOCKED::mailto:[EMAIL PROTECTED] MSN: [EMAIL PROTECTED] Information contained in this e-mail and any attachments are intended for the use of the addressee only, and may contain confidential information of Ubiquity Software Corporation. All unauthorized use, disclosure or distribution is strictly prohibited. If you are not the addressee, please notify the sender immediately and destroy all copies of this email. Unless otherwise expressly agreed in writing signed by an officer of Ubiquity Software Corporation, nothing in this communication shall be deemed to be legally binding. Thank you.
RE: SCA component invoking a callback from a separate thread
Ignacio, Thanks for the quick reply. I am currently experimenting with writing SIP enabled SCA components. SIP is an asynchronous request/response, session-based protocol, similar to HTTP. Tuscany is deployed within our SIP application server. Our SIP app server receives each incoming SIP request on a separate thread and sends each SIP response on a separate thread (obviously the threads are taken from a thread pool). Therefore the thread that processes the SIP request is not the same that sends the corresponding SIP response. The SIP request and SIP response belong to the same SIP session. The idea is to have a Connect component that has bi-directional interfaces (i.e. a service and callback interfaces). Here is the scenario I have been trying to implement: 1) The application calls the dial() method on the Dial component. 2) The dial() method creates and sends a SIP request to the SIP endpoint. The SIP request is sent asynchronously (i.e. the dial() method does not block until the SIP response is received). 3) The Connect component implements a listener that gets invoked when the SIP response is received by the SIP application server. The listener eventually receives the SIP response and then invokes a method called success() on the callback interface. The issue I am facing here is that the listener gets invoked from a different thread than the one used to send the SIP request. I realize that the threading model used here is a little different than the one you described below. However I was wondering if you would have any idea how this scenario could be handled nicely by Tuscany/SCA. I was also wondering whether you thought the conversation feature that you are planning to implement in Tuscany would be suitable for the scenario described above. Thanks for your input, Martin. -Original Message- From: Ignacio Silva-Lepe [mailto:[EMAIL PROTECTED] Sent: Thursday, November 09, 2006 12:45 PM To: tuscany-dev@ws.apache.org Subject: Re: SCA component invoking a callback from a separate thread Without looking at your whole component assembly or application, it's not clear to me why you would want to create your own thread. I assume your ComponentService.class includes a @Callback annotation to indicate what its callback interface is. This is sufficient to tell Tuscany that your Component.class methods are to be invoked on a separate thread, on which the callback invocation is also performed. Tuscany uses this thread to key a work context on which it caches the stack of from addresses that you are missing at the moment. If you look at the simplecallback sample you'll notice that MyServiceImpl invokes its callback method without having to deal with thread manipulation. On 11/9/06, Martin Leclerc [EMAIL PROTECTED] wrote: Hi, I am trying to write an SCA component that invokes a callback asynchronously (see code at the bottom of this message). In order to simulate an asynchronous notification, a new thread is created and the callback is invoked from within that thread. When I execute the application it throws the following exception: Exception in thread Thread-0 java.lang.AssertionError: Missing stack of from addresses at org.apache.tuscany.core.wire.jdk.JDKCallbackInvocationHandler.invoke(JDK CallbackInvocationHandler.java:61) at $Proxy17.done(Unknown Source) at test.Component2$1.run(Component2.java:32) at java.lang.Thread.run(Unknown Source) I suspect that the context required for the callback to work is not available from the new thread. My question is: is there a way for my component to invoke a callback from a different thread? If so, how can it be done? Thanks for your help, sample code @Service(ComponentService.class) public class Component implements ComponentService { private ComponentServiceCallback m_Callback; public Component() { } @Callback public void setCallback(ComponentServiceCallback a_Callback) { m_Callback = a_Callback; } public void run() { Runnable exec = new Runnable() { public void run() { m_Callback.done(); } }; new Thread(exec).start(); } } /sample code - Martin Leclerc Technical Architect Ubiquity Software www.ubiquitysoftware.com BLOCKED::http://www.ubiquitysoftware.com Phone: (613) 271-2027 Email: [EMAIL PROTECTED] BLOCKED::mailto:[EMAIL PROTECTED] MSN: [EMAIL PROTECTED] Information contained in this e-mail and any attachments are intended for the use of the addressee only, and may contain confidential information of Ubiquity Software Corporation. All unauthorized use, disclosure or distribution is strictly prohibited. If you are not the addressee, please notify the sender immediately and destroy
RE: SCA component invoking a callback from a separate thread
Ignacio, I made a few minor mistakes in my original email. So here is the better version :-) I am currently experimenting with developing SIP enabled SCA components. SIP is an asynchronous request/response, session-based protocol, similar to HTTP. Tuscany is deployed within our SIP application server. Our SIP app server sends each SIP request on a separate thread and receives each SIP response on a separate thread (obviously the threads are taken from a thread pool). Therefore the thread that sends the SIP request is not the same that processes the corresponding SIP response. The SIP request and SIP response belong to the same SIP session. The idea is to have a Connect component that has bi-directional interfaces (i.e. a service and callback interfaces). Here is the scenario I have been trying to implement: 1) The application calls the dial() method on the Connect component. 2) The dial() method creates and sends a SIP request to the SIP endpoint. The SIP request is sent asynchronously (i.e. the dial() method does not block until the SIP response is received). 3) The Connect component implements a listener that gets invoked when the SIP response is received by the SIP application server. The listener eventually receives the SIP response and then invokes a method called success() on the callback interface. The issue I am facing here is that the listener gets invoked from a different thread than the one used to send the SIP request. I realize that the threading model used here is a little different than the one you described below. However I was wondering if you would have any idea how this scenario could be handled nicely by Tuscany/SCA. I was also wondering whether you thought the conversation feature that you are planning to implement in Tuscany would be suitable for the scenario described above. Thanks for your input, Martin. -Original Message- From: Ignacio Silva-Lepe [mailto:[EMAIL PROTECTED] Sent: Thursday, November 09, 2006 12:45 PM To: tuscany-dev@ws.apache.org Subject: Re: SCA component invoking a callback from a separate thread Without looking at your whole component assembly or application, it's not clear to me why you would want to create your own thread. I assume your ComponentService.class includes a @Callback annotation to indicate what its callback interface is. This is sufficient to tell Tuscany that your Component.class methods are to be invoked on a separate thread, on which the callback invocation is also performed. Tuscany uses this thread to key a work context on which it caches the stack of from addresses that you are missing at the moment. If you look at the simplecallback sample you'll notice that MyServiceImpl invokes its callback method without having to deal with thread manipulation. On 11/9/06, Martin Leclerc [EMAIL PROTECTED] wrote: Hi, I am trying to write an SCA component that invokes a callback asynchronously (see code at the bottom of this message). In order to simulate an asynchronous notification, a new thread is created and the callback is invoked from within that thread. When I execute the application it throws the following exception: Exception in thread Thread-0 java.lang.AssertionError: Missing stack of from addresses at org.apache.tuscany.core.wire.jdk.JDKCallbackInvocationHandler.invoke(JDK CallbackInvocationHandler.java:61) at $Proxy17.done(Unknown Source) at test.Component2$1.run(Component2.java:32) at java.lang.Thread.run(Unknown Source) I suspect that the context required for the callback to work is not available from the new thread. My question is: is there a way for my component to invoke a callback from a different thread? If so, how can it be done? Thanks for your help, sample code @Service(ComponentService.class) public class Component implements ComponentService { private ComponentServiceCallback m_Callback; public Component() { } @Callback public void setCallback(ComponentServiceCallback a_Callback) { m_Callback = a_Callback; } public void run() { Runnable exec = new Runnable() { public void run() { m_Callback.done(); } }; new Thread(exec).start(); } } /sample code - Martin Leclerc Technical Architect Ubiquity Software www.ubiquitysoftware.com BLOCKED::http://www.ubiquitysoftware.com Phone: (613) 271-2027 Email: [EMAIL PROTECTED] BLOCKED::mailto:[EMAIL PROTECTED] MSN: [EMAIL PROTECTED] Information contained in this e-mail and any attachments are intended for the use of the addressee only, and may contain confidential information of Ubiquity Software Corporation. All unauthorized use, disclosure or distribution is strictly prohibited. If you
RE: Candidate M2 Distros @ http://people.apache.org/~rfeng/tuscany/incubator-M2/downloads/
Yes, it would be nice to make the binaries available! Thanks, Martin. -Original Message- From: Simon Nash [mailto:[EMAIL PROTECTED] Sent: Friday, November 03, 2006 4:57 PM To: tuscany-dev@ws.apache.org Subject: Re: Candidate M2 Distros @ http://people.apache.org/~rfeng/tuscany/incubator-M2/downloads/ I don't see the binary standalone distro there. Why is this not included? Simon Raymond Feng wrote: Hi, I uploaded the M2 candidate distros to http://people.apache.org/~rfeng/tuscany/incubator-M2/downloads/. Please review and provide feedbacks to us. The javadoc for osoa spec has not been included yet. I try to avoid changing the pom.xml to produce javadoc as it's tagged. Maybe I can run mvn javadoc:jar manually. Anyway it's work in progress. Thanks, Raymond - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Information contained in this e-mail and any attachments are intended for the use of the addressee only, and may contain confidential information of Ubiquity Software Corporation. All unauthorized use, disclosure or distribution is strictly prohibited. If you are not the addressee, please notify the sender immediately and destroy all copies of this email. Unless otherwise expressly agreed in writing signed by an officer of Ubiquity Software Corporation, nothing in this communication shall be deemed to be legally binding. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Documents and web site update for M2
Hi Raymond (and others), I have just tried to download and build Tuscany Java M2 code base from the trunk @ http://svn.apache.org/repos/asf/incubator/tuscany/java Here are the steps I followed: Removed all files and directories from Maven's repository (~/.m2/repository) md Tuscany cd Tuscany svn co http://svn.apache.org/repos/asf/incubator/tuscany/java cd java mvn After a few minutes of processing, Maven reported the following error: [INFO] Failed to resolve artifact. Missing: -- 1) org.apache.ws.commons.schema:XmlSchema:jar:SNAPSHOT Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.apache.ws.commons.schema -DartifactId=XmlSchema \ -Dversion=SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) org.apache.tuscany.sca.services.idl:wsdl:jar:1.0-incubator-M2-SNAPSHOT 2) org.apache.ws.commons.schema:XmlSchema:jar:SNAPSHOT -- 1 required artifact is missing. After I provisioned Maven with the missing jar file (downloaded from the following location: http://people.apache.org/repository/ws-commons/jars/) mvn install:install-file -DgroupId=org.apache.ws.commons.schema -DartifactId=XmlSchema -Dversion=SNAPSHOT -Dpackaging=jar -Dfile=C:\XmlSchema-SNAPSHOT.zip mvn Maven reported the following compile error: [INFO] Compilation failure C:\Tuscany\java\sca\services\idl\wsdl\src\main\java\org\apache\tuscany\i dl\wsdl\XMLSchemaRegistryImpl.java:[91,56] incompatible types found : org.apache.ws.commons.schema.XmlSchema required: org.apache.ws.commons.schema.XmlSchema[] I hope you will find this information useful as others might try to build Tuscany from the trunk. In the meantime, should I try to download and compile the Tuscany source code from the M2 branch as mentioned at http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg09661.html ? Thank you for your support, Martin. -Original Message- From: Raymond Feng [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 11:33 AM To: Martin Leclerc Subject: Re: Documents and web site update for M2 Hi, Martin. Thank you for your interest in Tuscany. There was an outrage with Apache infrastructure in the past few days and you might have experienced maven build problems because the Apache repositories were down. The document has not been updated to reflect the M2 branch (which will be released soon upon the Axis2 1.1). Before that, you can get the M2 branch from http://svn.apache.org/repos/asf/incubator/tuscany/branches/sca-java-M2 and follow steps discribed at http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg09661.html to build the binary. The trunk code @ http://svn.apache.org/repos/asf/incubator/tuscany/java should be runnable too. BTW, is it OK if I respond to your note on tuscany-dev@ws.apache.org where the information can be shared by the whole community? Thanks, Raymond - Original Message - From: Martin Leclerc [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 26, 2006 7:27 AM Subject: RE: Documents and web site update for M2 Hi Raymond, I started prototyping with Tuscany Java M1 about a week ago and I soon realized it would probably be better to use M2 since it seems to support a more up-to-date version of the SCA spec (0.96) as well as support for asynchronous programming (callbacks). I carefully followed the steps listed in http://wiki.apache.org/ws/Tuscany/TuscanyJava/GetTuscany to download the latest Tuscany Java M2 code base and build it. When I execute Maven (mvn) I run into errors when downloading libraries (XmlSchema, Axiom, Axis, Neethi) and after provisioning Maven with the missing libraries I get some compile errors. I suspect I might not be getting the code base from the right branch. So my questions are: 1) How can I download the latest Tuscany Java M2 code base and build it? 2) Is there a location where I can the latest build/binaries of Tuscany Java M2? Thank you for your time, Martin. Technical Architect Ubiquity Software www.ubiquitysoftware.com Phone: (613) 271-2027 Email: [EMAIL PROTECTED] MSN: [EMAIL PROTECTED] -Original Message- From: Raymond Feng [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 25, 2006 2:02 PM To: tuscany-dev@ws.apache.org Subject: Documents and web site update for M2 Hi, As we get the M2 branch fairly stable in the sense of code, now it's time to look at the documents and web site. I'm seeing several issues here: 1) Documents are scatted in different sources, including Web site, SVN, and Wiki. We don't have an organized navigation to these information. 2) Some of the documents are out of date and some of them are not complete. 3) We don't document for some features such as async web services. To jump start the efforts, I list some documents I expect to be useful for the release. I also collect a list of existing
RE: Documents and web site update for M2
My apologies, this is an early version of the email that was sent by mistake. The complete version of the email has just been sent to Tuscany-dev. Martin. -Original Message- From: Raymond Feng [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 12:54 PM To: tuscany-dev@ws.apache.org Subject: Re: Documents and web site update for M2 Hi, Martin. Can you give us a bit more information such as what jar is missing? Thanks, Raymond - Original Message - From: Martin Leclerc To: Raymond Feng Sent: Thursday, October 26, 2006 9:31 AM Subject: RE: Documents and web site update for M2 Raymond (and others), I just tried to build Tuscany Java M2 from the trunk @ http://svn.apache.org/repos/asf/incubator/tuscany/java. Unfortunately it failed while trying to download the following jar file: . After provisioning Maven with the missing jar file (which I found at ) I got a compile error. Here are the steps I followed: 1) Removed all directories and files from Maven's repository (~/.m2) 2) md Tuscany 3) cd Tuscany 4) svn co http://svn.apache.org/repos/asf/incubator/tuscany/java 5) I hope you will find the information useful as other people might try to build Tuscany from the trunk. Should I rather try to build Tuscany Java M2 using the M2 branch as mentioned at http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg09661.html ? Martin -Original Message- From: Raymond Feng [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 11:33 AM To: Martin Leclerc Subject: Re: Documents and web site update for M2 Hi, Martin. Thank you for your interest in Tuscany. There was an outrage with Apache infrastructure in the past few days and you might have experienced maven build problems because the Apache repositories were down. The document has not been updated to reflect the M2 branch (which will be released soon upon the Axis2 1.1). Before that, you can get the M2 branch from http://svn.apache.org/repos/asf/incubator/tuscany/branches/sca-java-M2 and follow steps discribed at http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg09661.html to build the binary. The trunk code @ http://svn.apache.org/repos/asf/incubator/tuscany/java should be runnable too. BTW, is it OK if I respond to your note on tuscany-dev@ws.apache.org where the information can be shared by the whole community? Thanks, Raymond - Original Message - From: Martin Leclerc [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 26, 2006 7:27 AM Subject: RE: Documents and web site update for M2 Hi Raymond, I started prototyping with Tuscany Java M1 about a week ago and I soon realized it would probably be better to use M2 since it seems to support a more up-to-date version of the SCA spec (0.96) as well as support for asynchronous programming (callbacks). I carefully followed the steps listed in http://wiki.apache.org/ws/Tuscany/TuscanyJava/GetTuscany to download the latest Tuscany Java M2 code base and build it. When I execute Maven (mvn) I run into errors when downloading libraries (XmlSchema, Axiom, Axis, Neethi) and after provisioning Maven with the missing libraries I get some compile errors. I suspect I might not be getting the code base from the right branch. So my questions are: 1) How can I download the latest Tuscany Java M2 code base and build it? 2) Is there a location where I can the latest build/binaries of Tuscany Java M2? Thank you for your time, Martin. Technical Architect Ubiquity Software www.ubiquitysoftware.com Phone: (613) 271-2027 Email: [EMAIL PROTECTED] MSN: [EMAIL PROTECTED] -Original Message- From: Raymond Feng [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 25, 2006 2:02 PM To: tuscany-dev@ws.apache.org Subject: Documents and web site update for M2 Hi, As we get the M2 branch fairly stable in the sense of code, now it's time to look at the documents and web site. I'm seeing several issues here: 1) Documents are scatted in different sources, including Web site, SVN, and Wiki. We don't have an organized navigation to these information. 2) Some of the documents are out of date and some of them are not complete. 3) We don't document for some features such as async web services. To jump start the efforts, I list some documents I expect to be useful for the release. I also collect a list of existing materials under each item. It's available @ http://wiki.apache.org/ws/Tuscany/TuscanyJava/M2Release. General stuff: 1) How to download the release? 2) How to check out the source from SVN and build with Maven? 3) How to load the source
RE: Repo content on people.a.o
Thanks Jeremy for the note. That would explain why I was having trouble compiling Tuscany Java. Please let me know when the various artifacts have been recovered. Martin. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Boynes Sent: Thursday, October 26, 2006 1:07 PM To: tuscany-dev@ws.apache.org Subject: Repo content on people.a.o It looks like the repo content on people.a.o after arounf 8/28 has been lost during the recovery of minotaur. This primarily affects content from incubator projects (like our M2 artifacts are no longer there) and snapshot content; releases from official Apache projects get mirrored to ibiblio. I will repost the pom and buildtools artifacts that we released a couple weeks ago. I believe I still have copies of the original signed versions and if so I don't think a re-vote is needed; if I have to generate new ones I will upload them with new signature and call a review vote. It also looks like the content from people's home directories has also been lost including the release candidates. Again, we can repost those if we have the originals or if they need to be regenerated, re-sign them and re-vote. -- Jeremy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Information contained in this e-mail and any attachments are intended for the use of the addressee only, and may contain confidential information of Ubiquity Software Corporation. All unauthorized use, disclosure or distribution is strictly prohibited. If you are not the addressee, please notify the sender immediately and destroy all copies of this email. Unless otherwise expressly agreed in writing signed by an officer of Ubiquity Software Corporation, nothing in this communication shall be deemed to be legally binding. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]