You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Giorgio Zoppi <gi...@gmail.com> on 2007/08/23 13:33:17 UTC

OneWay and Remote References

Hi,

Yesterday i was doing tests with SCA, but it doesn't do asynchronous remote invocation. I need it because I'm working
with streams of values.
For example:

import org.osoa.sca.annotations.OneWay;
import org.osoa.sca.annotations.Remotable;
/**
* This service that will be invoked in a non-blocking fashion
*/
@Remotable
public interface WorkerService {

    @OneWay
    public void compute(int value);
}

And this is its implementation:

@Service(WorkerService.class)
public class WorkerServiceImpl implements WorkerService {
    
    
    public void compute(int value) 
    { 
    System.out.println("Input Value = " + value);
    
    }
    
}

This is the client:

@Service(Workpool.class)
public class WorkpoolImpl implements Workpool {

    private WorkerService myService2;
    @Reference
    public void setMyService2(WorkerService myService2) {
        this.myService2 = myService2;
    }
    public void submit(int value) {
    myService2.compute(value);
    }
   
   }
And these are the bindings:
JVM_C
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
           targetNamespace="http://sample"
           xmlns:sample="http://sample"
           name="Workpool">

    <component name="WorkerServiceComponent2">
        <implementation.java class="workpool.WorkerServiceImpl" />
        <service name="WorkerService">
            <binding.sca
uri="http://localhost:8086/WorkerServiceComponent2"/>
</service>
    </component>

</composite>
JVM_B : domainNode
JVM_A:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" 
           targetNamespace="http://sample"
           xmlns:sample="http://sample"
           name="Workpool">

    <component name="WorkpoolServiceComponent">
<implementation.java class="workpool.WorkpoolImpl"/>
        <reference name="myService2" target="WorkerServiceComponent2"/>
     </component>    

    
</composite>

In my Node I have:

if ( nodeName.equals("nodeA") ) {
Workpool myClient = domain.getService(Workpool.class,
"WorkpoolServiceComponent");


for (int j = 1; j < 18; ++j )
{
myClient.submit(j);
}

   }

Its output:
$ ant
Buildfile: build.xml

runNodeC:
     [java]
file:/home/giorgio/sca.onwork/java/sca/samples/workpool/target/classes/management/
     [java] log4j:WARN No appenders could be found for logger
(org.apache.axiom.om.util.StAXUtils).
     [java] log4j:WARN Please initialize the log4j system properly.
     [java] ContributionURL
=file:/home/giorgio/sca.onwork/java/sca/samples/workpool/target/classes/nodeC/
     [java] My composite={http://sample}Workpool
     [java] Registering service: [mydomain nodeC WorkerServiceComponent2
org.apache.tuscany.sca.assembly.SCABinding
http://localhost:8086/WorkerServiceComponent2]
     [java] Registering service: [mydomain nodeC
WorkerServiceComponent2/WorkerService
org.apache.tuscany.sca.assembly.SCABinding
http://localhost:8086/WorkerServiceComponent2]
     [java] Added Servlet mapping:
http://localhost:8086/WorkerServiceComponent2
     [java] Node started (press enter to shutdown)
     [java] Input Value = 4
     [java] Input Value = 3

Instead of 18 values, which I should receive. 
But I'm now seeing in Axis2SCAReferenceBindingProvider..


 public boolean supportsAsyncOneWayInvocation() {
        return false;
    }

It seems that current runtime doesn't support it. Is there a some who's working on it before i'm going to implement it.
The same seems for remote Callbacks, are they working?

Cheers,
Jo. 

P.S You can find my code tarball at components http://components.ath.cx/sample-sca.tar.gz



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: OneWay and Remote References

Posted by Simon Laws <si...@googlemail.com>.
On 8/23/07, Giorgio Zoppi <gi...@gmail.com> wrote:
>
> 2007/8/23, Simon Laws <si...@googlemail.com>:
> > On 8/23/07, Simon Nash <na...@hursley.ibm.com> wrote:
> > >
> > > Giorgio,
> > > This is supported and working for both the local SCA binding and the
> > > Web Service binding.  The supportsAsyncOneWayInvocation=false setting
> > > means that the binding doesn't provide this support internally, so the
> > > core invocation framework adds a nonblocking interceptor that does a
> > > thread switch.  It appears that you are using the distributed
> > > SCA binding over Web services (is that correct?) so there could be an
> > > issue with this binding.  Bindings that can support async invocations
> > > internally are supposed to set the flag to true rather than false,
> > > and I'd expect the distributed SCA binding to fall into that category.
> > >
> > >    Simon
> >
> > > Hi Jo
> >
> > I'm fixing up the remote callbacks for the sca binding now. They should
> > already work for the local case and explicit web services bindings (see
> > samples/simple-callback  and  samples/simple-callback-ws) It needs
> changing
> > in the sca binding case now that raymond has changed the way that the
> > wires/invocation chains are created. If you want to make progress with
> > you're sample right now you could switch to the explicit web services
> > binding for the time being. Otherwise the fix should be done in an hour
> or
> > so (I hope:-)
> >
> > With one way invocations you've found something I haven't tried with the
> > default binding in remote mode. It's just using the web services binding
> > under the covers so there's no reason why it shouldn't work but I expect
> > there is some coding error. If you've got some thoughts here about
> what's
> > going wrong that would would good.
>
> Ok. Thank you very much. I'll try and debug it.
> Cheers,
> Jo.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
> Hi

I've put in some fixes now for callbacks across the remote version of the
sca binding and for @OneWay interfaces. There are a couple more simple test
cases to cover this in the binding-sca-axis2 module. In the one way case I
just replaced the line you identified with...

    public boolean supportsAsyncOneWayInvocation() {
        if (isTargetRemote()) {
            return distributedProvider.supportsAsyncOneWayInvocation();
        } else {
            return false;
        }
    }

The isTargetRemote call needs some caching applied to it as it gets used in
various places but the basic function is working.  The changes are checked
into trunk in svn now.

Regards

Simon

Re: OneWay and Remote References

Posted by Giorgio Zoppi <gi...@gmail.com>.
2007/8/23, Simon Laws <si...@googlemail.com>:
> On 8/23/07, Simon Nash <na...@hursley.ibm.com> wrote:
> >
> > Giorgio,
> > This is supported and working for both the local SCA binding and the
> > Web Service binding.  The supportsAsyncOneWayInvocation=false setting
> > means that the binding doesn't provide this support internally, so the
> > core invocation framework adds a nonblocking interceptor that does a
> > thread switch.  It appears that you are using the distributed
> > SCA binding over Web services (is that correct?) so there could be an
> > issue with this binding.  Bindings that can support async invocations
> > internally are supposed to set the flag to true rather than false,
> > and I'd expect the distributed SCA binding to fall into that category.
> >
> >    Simon
>
> > Hi Jo
>
> I'm fixing up the remote callbacks for the sca binding now. They should
> already work for the local case and explicit web services bindings (see
> samples/simple-callback  and  samples/simple-callback-ws) It needs changing
> in the sca binding case now that raymond has changed the way that the
> wires/invocation chains are created. If you want to make progress with
> you're sample right now you could switch to the explicit web services
> binding for the time being. Otherwise the fix should be done in an hour or
> so (I hope:-)
>
> With one way invocations you've found something I haven't tried with the
> default binding in remote mode. It's just using the web services binding
> under the covers so there's no reason why it shouldn't work but I expect
> there is some coding error. If you've got some thoughts here about what's
> going wrong that would would good.

Ok. Thank you very much. I'll try and debug it.
Cheers,
Jo.

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: OneWay and Remote References

Posted by Simon Laws <si...@googlemail.com>.
On 8/23/07, Simon Nash <na...@hursley.ibm.com> wrote:
>
> Giorgio,
> This is supported and working for both the local SCA binding and the
> Web Service binding.  The supportsAsyncOneWayInvocation=false setting
> means that the binding doesn't provide this support internally, so the
> core invocation framework adds a nonblocking interceptor that does a
> thread switch.  It appears that you are using the distributed
> SCA binding over Web services (is that correct?) so there could be an
> issue with this binding.  Bindings that can support async invocations
> internally are supposed to set the flag to true rather than false,
> and I'd expect the distributed SCA binding to fall into that category.
>
>    Simon
>
> Giorgio Zoppi wrote:
>
> > Hi,
> >
> > Yesterday i was doing tests with SCA, but it doesn't do asynchronous
> remote invocation. I need it because I'm working
> > with streams of values.
> > For example:
> >
> > import org.osoa.sca.annotations.OneWay;
> > import org.osoa.sca.annotations.Remotable;
> > /**
> > * This service that will be invoked in a non-blocking fashion
> > */
> > @Remotable
> > public interface WorkerService {
> >
> >     @OneWay
> >     public void compute(int value);
> > }
> >
> > And this is its implementation:
> >
> > @Service(WorkerService.class)
> > public class WorkerServiceImpl implements WorkerService {
> >
> >
> >     public void compute(int value)
> >     {
> >     System.out.println("Input Value = " + value);
> >
> >     }
> >
> > }
> >
> > This is the client:
> >
> > @Service(Workpool.class)
> > public class WorkpoolImpl implements Workpool {
> >
> >     private WorkerService myService2;
> >     @Reference
> >     public void setMyService2(WorkerService myService2) {
> >         this.myService2 = myService2;
> >     }
> >     public void submit(int value) {
> >     myService2.compute(value);
> >     }
> >
> >    }
> > And these are the bindings:
> > JVM_C
> > <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> >            targetNamespace="http://sample"
> >            xmlns:sample="http://sample"
> >            name="Workpool">
> >
> >     <component name="WorkerServiceComponent2">
> >         <implementation.java class="workpool.WorkerServiceImpl" />
> >         <service name="WorkerService">
> >             <binding.sca
> > uri="http://localhost:8086/WorkerServiceComponent2"/>
> > </service>
> >     </component>
> >
> > </composite>
> > JVM_B : domainNode
> > JVM_A:
> > <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> >            targetNamespace="http://sample"
> >            xmlns:sample="http://sample"
> >            name="Workpool">
> >
> >     <component name="WorkpoolServiceComponent">
> > <implementation.java class="workpool.WorkpoolImpl"/>
> >         <reference name="myService2" target="WorkerServiceComponent2"/>
> >      </component>
> >
> >
> > </composite>
> >
> > In my Node I have:
> >
> > if ( nodeName.equals("nodeA") ) {
> > Workpool myClient = domain.getService(Workpool.class,
> > "WorkpoolServiceComponent");
> >
> >
> > for (int j = 1; j < 18; ++j )
> > {
> > myClient.submit(j);
> > }
> >
> >    }
> >
> > Its output:
> > $ ant
> > Buildfile: build.xml
> >
> > runNodeC:
> >      [java]
> >
> file:/home/giorgio/sca.onwork/java/sca/samples/workpool/target/classes/management/
> >      [java] log4j:WARN No appenders could be found for logger
> > (org.apache.axiom.om.util.StAXUtils).
> >      [java] log4j:WARN Please initialize the log4j system properly.
> >      [java] ContributionURL
> >
> =file:/home/giorgio/sca.onwork/java/sca/samples/workpool/target/classes/nodeC/
> >      [java] My composite={http://sample}Workpool
> >      [java] Registering service: [mydomain nodeC WorkerServiceComponent2
> > org.apache.tuscany.sca.assembly.SCABinding
> > http://localhost:8086/WorkerServiceComponent2]
> >      [java] Registering service: [mydomain nodeC
> > WorkerServiceComponent2/WorkerService
> > org.apache.tuscany.sca.assembly.SCABinding
> > http://localhost:8086/WorkerServiceComponent2]
> >      [java] Added Servlet mapping:
> > http://localhost:8086/WorkerServiceComponent2
> >      [java] Node started (press enter to shutdown)
> >      [java] Input Value = 4
> >      [java] Input Value = 3
> >
> > Instead of 18 values, which I should receive.
> > But I'm now seeing in Axis2SCAReferenceBindingProvider..
> >
> >
> >  public boolean supportsAsyncOneWayInvocation() {
> >         return false;
> >     }
> >
> > It seems that current runtime doesn't support it. Is there a some who's
> working on it before i'm going to implement it.
> > The same seems for remote Callbacks, are they working?
> >
> > Cheers,
> > Jo.
> >
> > P.S You can find my code tarball at components
> http://components.ath.cx/sample-sca.tar.gz
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
> Hi Jo

I'm fixing up the remote callbacks for the sca binding now. They should
already work for the local case and explicit web services bindings (see
samples/simple-callback  and  samples/simple-callback-ws) It needs changing
in the sca binding case now that raymond has changed the way that the
wires/invocation chains are created. If you want to make progress with
you're sample right now you could switch to the explicit web services
binding for the time being. Otherwise the fix should be done in an hour or
so (I hope:-)

With one way invocations you've found something I haven't tried with the
default binding in remote mode. It's just using the web services binding
under the covers so there's no reason why it shouldn't work but I expect
there is some coding error. If you've got some thoughts here about what's
going wrong that would would good.

Regards

Simon L

Re: OneWay and Remote References

Posted by Simon Nash <na...@hursley.ibm.com>.
Giorgio,
This is supported and working for both the local SCA binding and the
Web Service binding.  The supportsAsyncOneWayInvocation=false setting
means that the binding doesn't provide this support internally, so the
core invocation framework adds a nonblocking interceptor that does a
thread switch.  It appears that you are using the distributed
SCA binding over Web services (is that correct?) so there could be an
issue with this binding.  Bindings that can support async invocations
internally are supposed to set the flag to true rather than false,
and I'd expect the distributed SCA binding to fall into that category.

   Simon

Giorgio Zoppi wrote:

> Hi,
> 
> Yesterday i was doing tests with SCA, but it doesn't do asynchronous remote invocation. I need it because I'm working
> with streams of values.
> For example:
> 
> import org.osoa.sca.annotations.OneWay;
> import org.osoa.sca.annotations.Remotable;
> /**
> * This service that will be invoked in a non-blocking fashion
> */
> @Remotable
> public interface WorkerService {
> 
>     @OneWay
>     public void compute(int value);
> }
> 
> And this is its implementation:
> 
> @Service(WorkerService.class)
> public class WorkerServiceImpl implements WorkerService {
>     
>     
>     public void compute(int value) 
>     { 
>     System.out.println("Input Value = " + value);
>     
>     }
>     
> }
> 
> This is the client:
> 
> @Service(Workpool.class)
> public class WorkpoolImpl implements Workpool {
> 
>     private WorkerService myService2;
>     @Reference
>     public void setMyService2(WorkerService myService2) {
>         this.myService2 = myService2;
>     }
>     public void submit(int value) {
>     myService2.compute(value);
>     }
>    
>    }
> And these are the bindings:
> JVM_C
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
>            targetNamespace="http://sample"
>            xmlns:sample="http://sample"
>            name="Workpool">
> 
>     <component name="WorkerServiceComponent2">
>         <implementation.java class="workpool.WorkerServiceImpl" />
>         <service name="WorkerService">
>             <binding.sca
> uri="http://localhost:8086/WorkerServiceComponent2"/>
> </service>
>     </component>
> 
> </composite>
> JVM_B : domainNode
> JVM_A:
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" 
>            targetNamespace="http://sample"
>            xmlns:sample="http://sample"
>            name="Workpool">
> 
>     <component name="WorkpoolServiceComponent">
> <implementation.java class="workpool.WorkpoolImpl"/>
>         <reference name="myService2" target="WorkerServiceComponent2"/>
>      </component>    
> 
>     
> </composite>
> 
> In my Node I have:
> 
> if ( nodeName.equals("nodeA") ) {
> Workpool myClient = domain.getService(Workpool.class,
> "WorkpoolServiceComponent");
> 
> 
> for (int j = 1; j < 18; ++j )
> {
> myClient.submit(j);
> }
> 
>    }
> 
> Its output:
> $ ant
> Buildfile: build.xml
> 
> runNodeC:
>      [java]
> file:/home/giorgio/sca.onwork/java/sca/samples/workpool/target/classes/management/
>      [java] log4j:WARN No appenders could be found for logger
> (org.apache.axiom.om.util.StAXUtils).
>      [java] log4j:WARN Please initialize the log4j system properly.
>      [java] ContributionURL
> =file:/home/giorgio/sca.onwork/java/sca/samples/workpool/target/classes/nodeC/
>      [java] My composite={http://sample}Workpool
>      [java] Registering service: [mydomain nodeC WorkerServiceComponent2
> org.apache.tuscany.sca.assembly.SCABinding
> http://localhost:8086/WorkerServiceComponent2]
>      [java] Registering service: [mydomain nodeC
> WorkerServiceComponent2/WorkerService
> org.apache.tuscany.sca.assembly.SCABinding
> http://localhost:8086/WorkerServiceComponent2]
>      [java] Added Servlet mapping:
> http://localhost:8086/WorkerServiceComponent2
>      [java] Node started (press enter to shutdown)
>      [java] Input Value = 4
>      [java] Input Value = 3
> 
> Instead of 18 values, which I should receive. 
> But I'm now seeing in Axis2SCAReferenceBindingProvider..
> 
> 
>  public boolean supportsAsyncOneWayInvocation() {
>         return false;
>     }
> 
> It seems that current runtime doesn't support it. Is there a some who's working on it before i'm going to implement it.
> The same seems for remote Callbacks, are they working?
> 
> Cheers,
> Jo. 
> 
> P.S You can find my code tarball at components http://components.ath.cx/sample-sca.tar.gz
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org