You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Jaliya Ekanayake <jn...@gmail.com> on 2006/05/12 21:03:41 UTC

[Axis2] How to run multiple clients using same ConfigurationContext

Hi Devs,

I wanted to run several clients to measure some performance.
The attached client does not get the result for all the threads and it
hangs. IMHO the problem is due to the way we use the client side transport
listener.
If client has some control at least to stop it then we will be able to
handle this kind of scenarios.

Although I am using the same service for all the clients a more realistic
example would be to invoke two services (or two operations) asynchronously
sharing same configuration context.

Can someone point me what is the error I have in the attached code.

Thanks,
Jaliya

Re: [Axis2] How to run multiple clients using same ConfigurationContext

Posted by Jaliya Ekanayake <jn...@gmail.com>.
Thanks Chamikara.

Jaliya
  ----- Original Message ----- 
  From: Chamikara Jayalath 
  To: axis-dev@ws.apache.org 
  Sent: Friday, May 12, 2006 4:25 PM
  Subject: Re: [Axis2] How to run multiple clients using same ConfigurationContext


  Hi Jaliya,

  I could get this working after two changes.

  Firstly Axis2 stops the SAS listner when the serviceClient.finalizeInvoke () is called.
  so I commented out the following line in the finally block.
  sender.finalizeInvoke();


  Secondly there seems to be a bug in the serviceclient.sendReceiveNonBlocking(QName, OMElement,Callback) method. 
  It is setting a new CallbackReceiver every time the method is called. Insted this should be 
  set only if its not already there in the operation. So I corrected this method as following.


      public void sendReceiveNonBlocking(QName operation, OMElement elem,
                                         Callback callback) throws AxisFault {
          MessageContext mc = new MessageContext();
          fillSoapEnvelope(mc, elem);
          OperationClient mepClient = createClient(operation);
          // here a blocking invocation happens in a new thread, so the
          // progamming model is non blocking
          mepClient.setCallback(callback);
          mepClient.addMessageContext(mc);
          if (options.isUseSeparateListener()) {
              if (callbackReceiver == null) {
                  callbackReceiver = new CallbackReceiver();
              }
              
              if (axisService.getOperation(operation).getMessageReceiver()==null)
                  axisService.getOperation(operation).setMessageReceiver(callbackReceiver);
          }
          mepClient.execute(false);
      }
  (changed line is in bold).


  After these two changes this worked for me. I tested upto 100 threads.



  Chamikara





  On 5/13/06, Jaliya Ekanayake <jn...@gmail.com> wrote:
    Oops wrong file. Please use the attached



    On 5/12/06, Jaliya Ekanayake < jnekanayake@gmail.com> wrote: 
      Hi Devs,

      I wanted to run several clients to measure some performance. 
      The attached client does not get the result for all the threads and it hangs. IMHO the problem is due to the way we use the client side transport listener. 
      If client has some control at least to stop it then we will be able to handle this kind of scenarios.

      Although I am using the same service for all the clients a more realistic example would be to invoke two services (or two operations) asynchronously sharing same configuration context. 

      Can someone point me what is the error I have in the attached code. 

      Thanks,

      Jaliya









Re: [Axis2] How to run multiple clients using same ConfigurationContext

Posted by Chamikara Jayalath <ch...@gmail.com>.
Done
http://issues.apache.org/jira/browse/AXIS2-726

Chamikara


On 5/13/06, Davanum Srinivas <da...@gmail.com> wrote:
>
> Please don't forget to log a bug and upload a diff :)
>
> thanks,
> dims
>
> On 5/12/06, Chamikara Jayalath <ch...@gmail.com> wrote:
> > Hi Jaliya,
> >
> >  I could get this working after two changes.
> >
> >  Firstly Axis2 stops the SAS listner when the
> serviceClient.finalizeInvoke
> > () is called.
> >  so I commented out the following line in the finally block.
> >  sender.finalizeInvoke();
> >
> >
> >  Secondly there seems to be a bug in the
> > serviceclient.sendReceiveNonBlocking(QName,
> > OMElement,Callback) method.
> >  It is setting a new CallbackReceiver every time the method is called.
> > Insted this should be
> >  set only if its not already there in the operation. So I corrected this
> > method as following.
> >
> >
> >      public void sendReceiveNonBlocking(QName operation, OMElement elem,
> >                                         Callback callback)
> > throws AxisFault {
> >          MessageContext mc = new MessageContext();
> >          fillSoapEnvelope(mc, elem);
> >          OperationClient mepClient = createClient(operation);
> >          // here a blocking invocation happens in a new thread, so the
> >          // progamming model is non blocking
> >          mepClient.setCallback(callback);
> >          mepClient.addMessageContext(mc);
> >          if (options.isUseSeparateListener()) {
> >              if (callbackReceiver == null) {
> >                  callbackReceiver = new CallbackReceiver();
> >              }
> >
> >              if
> > (axisService.getOperation(operation).getMessageReceiver()==null)
> >
> > axisService.getOperation
> (operation).setMessageReceiver(callbackReceiver);
> >          }
> >          mepClient.execute(false);
> >      }
> >  (changed line is in bold).
> >
> >
> >  After these two changes this worked for me. I tested upto 100 threads.
> >
> >
> >
> >  Chamikara
> >
> >
> >
> >
> > On 5/13/06, Jaliya Ekanayake <jn...@gmail.com> wrote:
> > >
> > > Oops wrong file. Please use the attached
> > >
> > >
> > >
> > > On 5/12/06, Jaliya Ekanayake < jnekanayake@gmail.com> wrote:
> > > >
> > > > Hi Devs,
> > > >
> > > > I wanted to run several clients to measure some performance.
> > > > The attached client does not get the result for all the threads and
> it
> > hangs. IMHO the problem is due to the way we use the client side
> transport
> > listener.
> > > > If client has some control at least to stop it then we will be able
> to
> > handle this kind of scenarios.
> > > >
> > > > Although I am using the same service for all the clients a more
> > realistic example would be to invoke two services (or two operations)
> > asynchronously sharing same configuration context.
> > > >
> > > > Can someone point me what is the error I have in the attached code.
> > > >
> > > > Thanks,
> > > >
> > > > Jaliya
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>
>
> --
> Davanum Srinivas : http://wso2.com/blogs/
>

Re: [Axis2] How to run multiple clients using same ConfigurationContext

Posted by Davanum Srinivas <da...@gmail.com>.
Please don't forget to log a bug and upload a diff :)

thanks,
dims

On 5/12/06, Chamikara Jayalath <ch...@gmail.com> wrote:
> Hi Jaliya,
>
>  I could get this working after two changes.
>
>  Firstly Axis2 stops the SAS listner when the serviceClient.finalizeInvoke
> () is called.
>  so I commented out the following line in the finally block.
>  sender.finalizeInvoke();
>
>
>  Secondly there seems to be a bug in the
> serviceclient.sendReceiveNonBlocking(QName,
> OMElement,Callback) method.
>  It is setting a new CallbackReceiver every time the method is called.
> Insted this should be
>  set only if its not already there in the operation. So I corrected this
> method as following.
>
>
>      public void sendReceiveNonBlocking(QName operation, OMElement elem,
>                                         Callback callback)
> throws AxisFault {
>          MessageContext mc = new MessageContext();
>          fillSoapEnvelope(mc, elem);
>          OperationClient mepClient = createClient(operation);
>          // here a blocking invocation happens in a new thread, so the
>          // progamming model is non blocking
>          mepClient.setCallback(callback);
>          mepClient.addMessageContext(mc);
>          if (options.isUseSeparateListener()) {
>              if (callbackReceiver == null) {
>                  callbackReceiver = new CallbackReceiver();
>              }
>
>              if
> (axisService.getOperation(operation).getMessageReceiver()==null)
>
> axisService.getOperation(operation).setMessageReceiver(callbackReceiver);
>          }
>          mepClient.execute(false);
>      }
>  (changed line is in bold).
>
>
>  After these two changes this worked for me. I tested upto 100 threads.
>
>
>
>  Chamikara
>
>
>
>
> On 5/13/06, Jaliya Ekanayake <jn...@gmail.com> wrote:
> >
> > Oops wrong file. Please use the attached
> >
> >
> >
> > On 5/12/06, Jaliya Ekanayake < jnekanayake@gmail.com> wrote:
> > >
> > > Hi Devs,
> > >
> > > I wanted to run several clients to measure some performance.
> > > The attached client does not get the result for all the threads and it
> hangs. IMHO the problem is due to the way we use the client side transport
> listener.
> > > If client has some control at least to stop it then we will be able to
> handle this kind of scenarios.
> > >
> > > Although I am using the same service for all the clients a more
> realistic example would be to invoke two services (or two operations)
> asynchronously sharing same configuration context.
> > >
> > > Can someone point me what is the error I have in the attached code.
> > >
> > > Thanks,
> > >
> > > Jaliya
> > >
> > >
> >
> >
> >
>
>


-- 
Davanum Srinivas : http://wso2.com/blogs/

Re: [Axis2] How to run multiple clients using same ConfigurationContext

Posted by Chamikara Jayalath <ch...@gmail.com>.
Hi Jaliya,

I could get this working after two changes.

Firstly Axis2 stops the SAS listner when the serviceClient.finalizeInvoke ()
is called.
so I commented out the following line in the finally block.
sender.finalizeInvoke();


Secondly there seems to be a bug in the
serviceclient.sendReceiveNonBlocking(QName,
OMElement,Callback) method.
It is setting a new CallbackReceiver every time the method is called. Insted
this should be
set only if its not already there in the operation. So I corrected this
method as following.


    public void sendReceiveNonBlocking(QName operation, OMElement elem,
                                       Callback callback) throws AxisFault {
        MessageContext mc = new MessageContext();
        fillSoapEnvelope(mc, elem);
        OperationClient mepClient = createClient(operation);
        // here a blocking invocation happens in a new thread, so the
        // progamming model is non blocking
        mepClient.setCallback(callback);
        mepClient.addMessageContext(mc);
        if (options.isUseSeparateListener()) {
            if (callbackReceiver == null) {
                callbackReceiver = new CallbackReceiver();
            }

            if (axisService.getOperation
(operation).getMessageReceiver()==null)
                axisService.getOperation
(operation).setMessageReceiver(callbackReceiver);
        }
        mepClient.execute(false);
    }
(changed line is in bold).


After these two changes this worked for me. I tested upto 100 threads.



Chamikara




On 5/13/06, Jaliya Ekanayake <jn...@gmail.com> wrote:
>
> Oops wrong file. Please use the attached
>
>
> On 5/12/06, Jaliya Ekanayake <jn...@gmail.com> wrote:
> >
> > Hi Devs,
> >
> > I wanted to run several clients to measure some performance.
> > The attached client does not get the result for all the threads and it
> > hangs. IMHO the problem is due to the way we use the client side transport
> > listener.
> > If client has some control at least to stop it then we will be able to
> > handle this kind of scenarios.
> >
> > Although I am using the same service for all the clients a more
> > realistic example would be to invoke two services (or two operations)
> > asynchronously sharing same configuration context.
> >
> > Can someone point me what is the error I have in the attached code.
> >
> > Thanks,
> > Jaliya
> >
> >
>
>

Re: [Axis2] How to run multiple clients using same ConfigurationContext

Posted by Jaliya Ekanayake <jn...@gmail.com>.
Oops wrong file. Please use the attached

On 5/12/06, Jaliya Ekanayake <jn...@gmail.com> wrote:
>
> Hi Devs,
>
> I wanted to run several clients to measure some performance.
> The attached client does not get the result for all the threads and it
> hangs. IMHO the problem is due to the way we use the client side transport
> listener.
> If client has some control at least to stop it then we will be able to
> handle this kind of scenarios.
>
> Although I am using the same service for all the clients a more realistic
> example would be to invoke two services (or two operations) asynchronously
> sharing same configuration context.
>
> Can someone point me what is the error I have in the attached code.
>
> Thanks,
> Jaliya
>
>