Re: Question about RPC calls

2009-11-17 Thread Ian Bambury
Mmm. I'd prefer to be sure that I have each rpc call complete successfully
the last time it ran rather than open up the possibility that one of them
completed successfully 3 times and the other two either failed an
indeterminate number of times or didn't get called at all.

Depends on the situation, of course.

Ian

http://examples.roughian.com


2009/11/17 Eric 

> On Nov 17, 10:56 am, Ian Bambury  wrote:
> > The problem with that is that you have to wait for call A to return
> before
> > initiating call B. What if you have 5 or 6 calls. Or the user can submit
> > different bits as and when?
> >
> > The best way is to make a single rpc call which does everything you want
> out
> > of A and B when everything is ready.
> >
> > If there are too many combinations, then send a set of commands.
> >
> > If you want to/have to do it on the client, then you have to check that
> > everything has returned OK and when they have, do that 'some code' stuff
> >
> > You need to have some way to indicate that each call has returned and
> each
> > return checks if everything is ready. If you are waiting for data, just
> > check if the data is there, otherwise use flags. E.g.
> >
> > boolean aReturned = false;
> > boolean bReturned = false;
> > boolean cReturned = false;
> >
> > rpcA()
> > {
> >onSuccess()
> >{
> >   aReturned=true;
> >   check();
> >}
> >
> > }
> >
> > rpcB()
> > {
> >onSuccess()
> >{
> >   bReturned=true;
> >   check();
> >}}
> >
> > rpcC()
> > {
> >onSuccess()
> >{
> >   cReturned=true;
> >   check();
> >}
> >
> > }
> >
> > check()
> > {
> >if(aReturned && bReturned && cReturned)
> >{
> >// Do stuff with a, b and c
> >}
> >
> > }
>
> Perhaps a more event-driven system would work, similar to the JDK
> java.util.concurrent.CountdownLatch class.  Create a Countdown class
> implementing HasValue, a CountdownEvent extending
> ValueChangeEvent, initialize a Countdown named latch
> before the three RPC calls, call latch.countdown() from each of
> the onSuccess methods, and listen for the count to hit 0 and blastoff.
>
> Respectfully,
> Eric Jablow
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.




Re: Question about RPC calls

2009-11-17 Thread Eric
On Nov 17, 10:56 am, Ian Bambury  wrote:
> The problem with that is that you have to wait for call A to return before
> initiating call B. What if you have 5 or 6 calls. Or the user can submit
> different bits as and when?
>
> The best way is to make a single rpc call which does everything you want out
> of A and B when everything is ready.
>
> If there are too many combinations, then send a set of commands.
>
> If you want to/have to do it on the client, then you have to check that
> everything has returned OK and when they have, do that 'some code' stuff
>
> You need to have some way to indicate that each call has returned and each
> return checks if everything is ready. If you are waiting for data, just
> check if the data is there, otherwise use flags. E.g.
>
> boolean aReturned = false;
> boolean bReturned = false;
> boolean cReturned = false;
>
> rpcA()
> {
>    onSuccess()
>    {
>       aReturned=true;
>       check();
>    }
>
> }
>
> rpcB()
> {
>    onSuccess()
>    {
>       bReturned=true;
>       check();
>    }}
>
> rpcC()
> {
>    onSuccess()
>    {
>       cReturned=true;
>       check();
>    }
>
> }
>
> check()
> {
>    if(aReturned && bReturned && cReturned)
>    {
>    // Do stuff with a, b and c
>    }
>
> }

Perhaps a more event-driven system would work, similar to the JDK
java.util.concurrent.CountdownLatch class.  Create a Countdown class
implementing HasValue, a CountdownEvent extending
ValueChangeEvent, initialize a Countdown named latch
before the three RPC calls, call latch.countdown() from each of
the onSuccess methods, and listen for the count to hit 0 and blastoff.

Respectfully,
Eric Jablow


--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.




Re: Question about RPC calls

2009-11-17 Thread Zenon
LoL!

I already thought about using flags, but not to call check() for every
function...

Thank you man!

On 17 Nov, 16:56, Ian Bambury  wrote:
> The problem with that is that you have to wait for call A to return before
> initiating call B. What if you have 5 or 6 calls. Or the user can submit
> different bits as and when?
>
> The best way is to make a single rpc call which does everything you want out
> of A and B when everything is ready.
>
> If there are too many combinations, then send a set of commands.
>
> If you want to/have to do it on the client, then you have to check that
> everything has returned OK and when they have, do that 'some code' stuff
>
> You need to have some way to indicate that each call has returned and each
> return checks if everything is ready. If you are waiting for data, just
> check if the data is there, otherwise use flags. E.g.
>
> boolean aReturned = false;
> boolean bReturned = false;
> boolean cReturned = false;
>
> rpcA()
> {
>    onSuccess()
>    {
>       aReturned=true;
>       check();
>    }
>
> }
>
> rpcB()
> {
>    onSuccess()
>    {
>       bReturned=true;
>       check();
>    }}
>
> rpcC()
> {
>    onSuccess()
>    {
>       cReturned=true;
>       check();
>    }
>
> }
>
> check()
> {
>    if(aReturned && bReturned && cReturned)
>    {
>    // Do stuff with a, b and c
>    }
>
> }
>
> Ian
>
> http://examples.roughian.com
>
> 2009/11/17 olivier nouguier 
>
>
>
> > Hi,
> >  Basically:
> > rpc_funct_A(){
> >  onSuccess(){
> >  rpc_funct_B(){
> >   onSuccess(){

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.




Re: Question about RPC calls

2009-11-17 Thread Zenon
Lol!

I just have thought of using flags, but not to call check() for every
function...

Thanks!

2009/11/17 Ian Bambury :
> The problem with that is that you have to wait for call A to return before
> initiating call B. What if you have 5 or 6 calls. Or the user can submit
> different bits as and when?
> The best way is to make a single rpc call which does everything you want out
> of A and B when everything is ready.
> If there are too many combinations, then send a set of commands.
> If you want to/have to do it on the client, then you have to check that
> everything has returned OK and when they have, do that 'some code' stuff
>
> You need to have some way to indicate that each call has returned and each
> return checks if everything is ready. If you are waiting for data, just
> check if the data is there, otherwise use flags. E.g.
> boolean aReturned = false;
> boolean bReturned = false;
> boolean cReturned = false;
> rpcA()
> {
>    onSuccess()
>    {
>       aReturned=true;
>       check();
>    }
> }
> rpcB()
> {
>    onSuccess()
>    {
>       bReturned=true;
>       check();
>    }
> }
> rpcC()
> {
>    onSuccess()
>    {
>       cReturned=true;
>       check();
>    }
> }
> check()
> {
>    if(aReturned && bReturned && cReturned)
>    {
>    // Do stuff with a, b and c
>    }
> }
> Ian
>
> http://examples.roughian.com
>
>
> 2009/11/17 olivier nouguier 
>>
>> Hi,
>>  Basically:
>> rpc_funct_A(){
>>  onSuccess(){
>>  rpc_funct_B(){
>>   onSuccess(){
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=.
>

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.




Re: Question about RPC calls

2009-11-17 Thread Ian Bambury
The problem with that is that you have to wait for call A to return before
initiating call B. What if you have 5 or 6 calls. Or the user can submit
different bits as and when?

The best way is to make a single rpc call which does everything you want out
of A and B when everything is ready.

If there are too many combinations, then send a set of commands.

If you want to/have to do it on the client, then you have to check that
everything has returned OK and when they have, do that 'some code' stuff

You need to have some way to indicate that each call has returned and each
return checks if everything is ready. If you are waiting for data, just
check if the data is there, otherwise use flags. E.g.

boolean aReturned = false;
boolean bReturned = false;
boolean cReturned = false;

rpcA()
{
   onSuccess()
   {
  aReturned=true;
  check();
   }
}

rpcB()
{
   onSuccess()
   {
  bReturned=true;
  check();
   }
}
rpcC()
{
   onSuccess()
   {
  cReturned=true;
  check();
   }
}

check()
{
   if(aReturned && bReturned && cReturned)
   {
   // Do stuff with a, b and c
   }
}

Ian

http://examples.roughian.com


2009/11/17 olivier nouguier 

> Hi,
>  Basically:
> rpc_funct_A(){
>  onSuccess(){
>  rpc_funct_B(){
>   onSuccess(){
>
>

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.




Re: Question about RPC calls

2009-11-17 Thread olivier nouguier
Hi,
 Basically:
rpc_funct_A(){
 onSuccess(){
 rpc_funct_B(){
  onSuccess(){
 // some code to execute only when both functions get to an end.
  }
 }
 }
}

A look at MVP + Event Driven should give you some nice design/pattern.

On Tue, Nov 17, 2009 at 3:04 PM, Zenon  wrote:

> Hello, I was wandering how to find out when 2 RP calls finish in order
> to execute some code.
>
> An example:
>
> rpc_funct_A();
>
> rpc_funct_B();
>
> // some code to execute only when both functions get to an end.
>
> As you know, *some code* could probably begin before rpc_funct ends
> their execution
> and I don't want that.
>
> Thanks in advance
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=.
>
>
>


-- 
A coward is incapable of exhibiting love; it is the prerogative of the
brave.
--
Mohandas Gandhi

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.




Question about RPC calls

2009-11-17 Thread Zenon
Hello, I was wandering how to find out when 2 RP calls finish in order
to execute some code.

An example:

rpc_funct_A();

rpc_funct_B();

// some code to execute only when both functions get to an end.

As you know, *some code* could probably begin before rpc_funct ends
their execution
and I don't want that.

Thanks in advance

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.




Re: About RPC

2008-10-04 Thread sunny zhou

Hi Sumit,

> 1) Could you try debugging through your server-side code, up until the
> point it returns the response back up to the hosted mode browser? As
> you mentioned the method itself runs and returns fast enough, but I
> would to make sure there isn't some RemoteServiceServlet boiler-plate
> code where the response is getting trapped and taking longer. Since
> your application seems to work fine in web mode, this is probably
> unlikely but worth checking out.
= You are right!
= There is a RemoteServiceServlet boiler-plate code where the response
is getting trapped and taking longer.

thanks for your help!
if there weren't be a vocation, i would have replied to you earlier. i
am sorry if it causes you any trouble.

Have a pleasant day!
-Sunny Chow
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: About RPC

2008-09-25 Thread Sumit Chandel

Hi Sunny,

I can't say for sure what's going wrong in step 3), but to help figure
it out I wanted to suggest a couple of things to narrow it down.

Before that, a quick note about the size of the data you're sending
over - it doesn't seem like the size of the objects you're sending
back would be sufficient to stall the response, but could you try with
a smaller data set just to see how the RPC call responds? That would
clue us in as to whether the data you're sending is causing the
problem. If you could also track the size of the payload being sent
over the wire, that would also be helpful.

Now more troubleshooting suggestions:

1) Could you try debugging through your server-side code, up until the
point it returns the response back up to the hosted mode browser? As
you mentioned the method itself runs and returns fast enough, but I
would to make sure there isn't some RemoteServiceServlet boiler-plate
code where the response is getting trapped and taking longer. Since
your application seems to work fine in web mode, this is probably
unlikely but worth checking out.

2) Could you try running hosted mode with the -noserver option, using
your production server instead of the embedded Tomcat instance? This
would help isolate the problem to either the embedded Tomcat instance
or the hosted mode code dispatching and running the asynchronous
callback.

Hope that helps,
-Sumit Chandel

On Tue, Sep 23, 2008 at 7:07 AM, sunny_zhou <[EMAIL PROTECTED]> wrote:
>
> Hi Sumit,
>
> Thanks for your reply!
>
> I'm a beginner at GWT, so try to be patient with me, i will try my
> best.
>
>> Could you be a bit more specific about how much stuff is crammed into
>> the POJO that is being sent through RPC? It's certainly not hosted
>> mode's normal behaviour to take ten seconds to send an object through
>> RPC, unless this is a really heavy duty object.
>
> the POJO is a list of 16 objects, the list size is 30~50. One of the
> objects is a list of 3~5 objects, the list size is about 10. BTW, i am
> using GWT 1.5.
>
>> Also, is this happening in -noserver mode or using hosted mode's
>> embedded Tomcat instance? With some more info, we should be able to
>> get to the bottom of this.
>
> this is happening in hosted mode's embedded Tomcat instance.
>
> the observed behavior is:
> 1. RPC call is made
> 2. server side method runs and returns (quickly!)
> 3. ... huge delay with no CPU activity ...
> 4. finally client side onSuccess() RPC callback runs
>
> What could be happening on step 3 ?
>
> Best wishes!
> -sunny zhou
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: About RPC

2008-09-22 Thread sunny_zhou

Hi Sumit,

Thanks for your reply!

I'm a beginner at GWT, so try to be patient with me, i will try my
best.

> Could you be a bit more specific about how much stuff is crammed into
> the POJO that is being sent through RPC? It's certainly not hosted
> mode's normal behaviour to take ten seconds to send an object through
> RPC, unless this is a really heavy duty object.

the POJO is a list of 16 objects, the list size is 30~50. One of the
objects is a list of 3~5 objects, the list size is about 10. BTW, i am
using GWT 1.5.

> Also, is this happening in -noserver mode or using hosted mode's
> embedded Tomcat instance? With some more info, we should be able to
> get to the bottom of this.

this is happening in hosted mode's embedded Tomcat instance.

the observed behavior is:
1. RPC call is made
2. server side method runs and returns (quickly!)
3. ... huge delay with no CPU activity ...
4. finally client side onSuccess() RPC callback runs

What could be happening on step 3 ?

Best wishes!
-sunny zhou



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: About RPC

2008-09-22 Thread Sumit Chandel

Hi Sunny,

Could you be a bit more specific about how much stuff is crammed into
the POJO that is being sent through RPC? It's certainly not hosted
mode's normal behaviour to take ten seconds to send an object through
RPC, unless this is a really heavy duty object.

Also, is this happening in -noserver mode or using hosted mode's
embedded Tomcat instance? With some more info, we should be able to
get to the bottom of this.

Cheers,
-Sumit Chandel

On Fri, Sep 19, 2008 at 3:56 AM, sunny_zhou <[EMAIL PROTECTED]> wrote:
>
> When server has to send a complicated POJO to client,it cost about ten
> seconds.
> However,when it compiled to js,it won't take a second.
> Is there anything we can do to accelerate when such RPC has to run in
> GWT's hosted web?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Sequence Diagram about RPC mechanism

2008-09-19 Thread Antony87

Hello,

Where can I find a Sequence diagram who explain the RPC mechanism ?

Thank's for all

Antony

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



About RPC

2008-09-18 Thread sunny_zhou

When server has to send a complicated POJO to client,it cost about ten
seconds.
However,when it compiled to js,it won't take a second.
Is there anything we can do to accelerate when such RPC has to run in
GWT's hosted web?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---