You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Tim Bartley <tb...@au1.ibm.com> on 2005/02/24 00:54:00 UTC

Client stub reuse

Hi,

Are there any limitations on the reuse of client stub objects?

For example support I have Foo.wsdl and generate a client stub class Foo. 
Is it safe to do:

Foo stub;

while (1) {
        char* url = <choose url from list of replicated servers>;
        if (tried all servers) {
                return error;
        }

        stub.setEndpoint(url);
        try {
                stub.invoke();
                return success;
        }
        catch (server unavailable) {
                continue;
        }
        catch (...) {
                return error;
        }
}

I expect that the stubs are re-entrant but not thread safe i.e. I expect 
to use exactly one, long lived, stub object per-thread (yes, I realize the 
code above doesn't quite achieve that).

Also, are transport connections e.g. in HTTP 1.1. transport, reused 
between method invocations? This particularly important for SSL where 
connection set up overhead can be very high. I assume they are (which is 
why I want to do the above) but thought I'd check.

Thanks,

Tim
--
IBM Tivoli Access Manager Development
Gold Coast Development Lab, Australia
+61-7-5552-4001 phone
+61-7-5571-0420 fax

Re: Client stub reuse

Posted by Victor Schrader <vs...@covad.net>.
If you have client code that leaks memory, that would be a substantial
constraint, or even code that alloc's and dealloc vectors in a tight loop.

Vic.

----- Original Message -----
From: "Samisa Abeysinghe" <sa...@gmail.com>
To: "Apache AXIS C User List" <ax...@ws.apache.org>
Sent: Wednesday, February 23, 2005 11:34 PM
Subject: Re: Client stub reuse


> Hi Tim,
>     Please see the answeres below:
>
>
> On Thu, 24 Feb 2005 09:54:00 +1000, Tim Bartley <tb...@au1.ibm.com>
wrote:
> >
> > Hi,
> >
> > Are there any limitations on the reuse of client stub objects?
> >
> > For example support I have Foo.wsdl and generate a client stub class
Foo. Is
> > it safe to do:
> >
> > Foo stub;
> >
> > while (1) {
> >         char* url = <choose url from list of replicated servers>;
> >         if (tried all servers) {
> >                 return error;
> >         }
> >
> >         stub.setEndpoint(url);
> >         try {
> >                 stub.invoke();
> >                 return success;
> >         }
> >         catch (server unavailable) {
> >                 continue;
> >         }
> >         catch (...) {
> >                 return error;
> >         }
> > }
> >
> > I expect that the stubs are re-entrant but not thread safe i.e. I expect
to
> > use exactly one, long lived, stub object per-thread (yes, I realize the
code
> > above doesn't quite achieve that).
> >
>
> This is possible.
> The Stubs are supposed to be re-entrant and the scenario you are
> talking about should work.
>
> > Also, are transport connections e.g. in HTTP 1.1. transport, reused
between
> > method invocations? This particularly important for SSL where connection
set
> > up overhead can be very high. I assume they are (which is why I want to
do
> > the above) but thought I'd check.
> >
>
> Yes, if HTTP/1.1 is being used connection is reused. It checks if the
> URL has been changed between calls and if not it keeps the connection.
>
> In case of HTTP/1.0, if keep-alive HTTP header is set, then the
> conection is reused. Else it is closed as per the HTTP semantics.
>
> Thanks,
> Samisa...
>
> > Thanks,
> >
> > Tim
> > --
> > IBM Tivoli Access Manager Development
> > Gold Coast Development Lab, Australia
> > +61-7-5552-4001 phone
> > +61-7-5571-0420 fax
>


Re: Client stub reuse

Posted by Samisa Abeysinghe <sa...@gmail.com>.
Hi Tim,
    Please see the answeres below:


On Thu, 24 Feb 2005 09:54:00 +1000, Tim Bartley <tb...@au1.ibm.com> wrote:
> 
> Hi, 
> 
> Are there any limitations on the reuse of client stub objects? 
> 
> For example support I have Foo.wsdl and generate a client stub class Foo. Is
> it safe to do: 
> 
> Foo stub; 
> 
> while (1) { 
>         char* url = <choose url from list of replicated servers>; 
>         if (tried all servers) { 
>                 return error; 
>         } 
> 
>         stub.setEndpoint(url); 
>         try { 
>                 stub.invoke(); 
>                 return success; 
>         } 
>         catch (server unavailable) { 
>                 continue; 
>         } 
>         catch (...) { 
>                 return error; 
>         } 
> } 
> 
> I expect that the stubs are re-entrant but not thread safe i.e. I expect to
> use exactly one, long lived, stub object per-thread (yes, I realize the code
> above doesn't quite achieve that). 
> 

This is possible.
The Stubs are supposed to be re-entrant and the scenario you are
talking about should work.

> Also, are transport connections e.g. in HTTP 1.1. transport, reused between
> method invocations? This particularly important for SSL where connection set
> up overhead can be very high. I assume they are (which is why I want to do
> the above) but thought I'd check. 
> 

Yes, if HTTP/1.1 is being used connection is reused. It checks if the
URL has been changed between calls and if not it keeps the connection.

In case of HTTP/1.0, if keep-alive HTTP header is set, then the
conection is reused. Else it is closed as per the HTTP semantics.

Thanks,
Samisa...

> Thanks, 
> 
> Tim
> --
> IBM Tivoli Access Manager Development
> Gold Coast Development Lab, Australia
> +61-7-5552-4001 phone
> +61-7-5571-0420 fax