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 "Akhila (JIRA)" <ji...@apache.org> on 2008/10/15 15:35:44 UTC

[jira] Created: (AXIS2-4085) While loop doesnot exit while running echo non blocking client

While loop doesnot exit while running echo non blocking client 
---------------------------------------------------------------

                 Key: AXIS2-4085
                 URL: https://issues.apache.org/jira/browse/AXIS2-4085
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: samples
    Affects Versions: 1.4.1
         Environment: Windows XP Professional Vesion 2002 SP-2 , NetBeans 6.1
            Reporter: Akhila
            Priority: Critical



public class EchoNonBlockingClient {
    private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");
    public static void main(String[] args) {
        ServiceClient sender = null;
        try {
            OMElement payload = ClientUtil.getEchoOMElement();
            Options options = new Options();
            options.setTo(targetEPR);
            options.setAction("urn:echo");
          TestCallback axisCallback = new TestCallback( " Call Back 1 "  ) ;
             sender = new ServiceClient();
            sender.setOptions(options);
            sender.sendReceiveNonBlocking( payload, axisCallback );
            //Wait till the callback receives the response.
           while (  ! axisCallback.isComplete( ) )  {
              Thread.sleep(1000);
            }


While running  this program ( echo-nonblocking client ( using axisCallback interface instead of Callback ) )  , it goes to infinite loop in     while (  ! axisCallback.isComplete( ) )  {
              Thread.sleep(1000);
            }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (AXIS2-4085) While loop doesnot exit while running echo non blocking client

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deepal Jayasinghe resolved AXIS2-4085.
--------------------------------------

    Resolution: Fixed

issues if fixed in the current SVN

> While loop doesnot exit while running echo non blocking client 
> ---------------------------------------------------------------
>
>                 Key: AXIS2-4085
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4085
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: samples
>    Affects Versions: 1.4.1
>         Environment: Windows XP Professional Vesion 2002 SP-2 , NetBeans 6.1
>            Reporter: Akhila
>            Priority: Critical
>
> public class EchoNonBlockingClient {
>     private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");
>     public static void main(String[] args) {
>         ServiceClient sender = null;
>         try {
>             OMElement payload = ClientUtil.getEchoOMElement();
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setAction("urn:echo");
>           TestCallback axisCallback = new TestCallback( " Call Back 1 "  ) ;
>              sender = new ServiceClient();
>             sender.setOptions(options);
>             sender.sendReceiveNonBlocking( payload, axisCallback );
>             //Wait till the callback receives the response.
>            while (  ! axisCallback.isComplete( ) )  {
>               Thread.sleep(1000);
>             }
> While running  this program ( echo-nonblocking client ( using axisCallback interface instead of Callback ) )  , it goes to infinite loop in     while (  ! axisCallback.isComplete( ) )  {
>               Thread.sleep(1000);
>             }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AXIS2-4085) While loop doesnot exit while running echo non blocking client

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645112#action_12645112 ] 

Deepal Jayasinghe commented on AXIS2-4085:
------------------------------------------

I think you have to implement the setComplete method 
Deepal

> While loop doesnot exit while running echo non blocking client 
> ---------------------------------------------------------------
>
>                 Key: AXIS2-4085
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4085
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: samples
>    Affects Versions: 1.4.1
>         Environment: Windows XP Professional Vesion 2002 SP-2 , NetBeans 6.1
>            Reporter: Akhila
>            Priority: Critical
>
> public class EchoNonBlockingClient {
>     private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");
>     public static void main(String[] args) {
>         ServiceClient sender = null;
>         try {
>             OMElement payload = ClientUtil.getEchoOMElement();
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setAction("urn:echo");
>           TestCallback axisCallback = new TestCallback( " Call Back 1 "  ) ;
>              sender = new ServiceClient();
>             sender.setOptions(options);
>             sender.sendReceiveNonBlocking( payload, axisCallback );
>             //Wait till the callback receives the response.
>            while (  ! axisCallback.isComplete( ) )  {
>               Thread.sleep(1000);
>             }
> While running  this program ( echo-nonblocking client ( using axisCallback interface instead of Callback ) )  , it goes to infinite loop in     while (  ! axisCallback.isComplete( ) )  {
>               Thread.sleep(1000);
>             }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-4085) While loop doesnot exit while running echo non blocking client

Posted by "Akhila (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645152#action_12645152 ] 

Akhila commented on AXIS2-4085:
-------------------------------

hi ,
 
thanks for your reply , i gave these methods only while defiinig testCallBack class that implement axisCallback method . the full class is given below .
package userguide.clients;

 

import javax.mail.MessageContext;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.client.async.AsyncResult;
import org.apache.axis2.client.async.AxisCallback;
import org.apache.axis2.client.async.Callback;

/**
 * Sample for asynchronous single channel non-blocking service invocation.
 * Message Exchage Pattern IN-OUT
 */
public class EchoNonBlockingClient {
    private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");
    public static void main(String[] args) {
        ServiceClient sender = null;
        try {
            OMElement payload = ClientUtil.getEchoOMElement();
            Options options = new Options();
            options.setTo(targetEPR);
            options.setAction("urn:echo");
          TestCallback axisCallback = new TestCallback( " Call Back 1 "  ) ;
             sender = new ServiceClient();
            sender.setOptions(options);
            sender.sendReceiveNonBlocking( payload, axisCallback );
             System.out.println( " after service client ") ;
            //Wait till the callback receives the response.
            // axisCallback.onComplete( ) ;
           while (  ! axisCallback.isComplete( ) )  {
    //            Thread.sleep(1000);
                 Thread.sleep(10);
            }

          //  System.out.println( " completed ") ;

            //Callback to handle the response
 /*      Callback callback = new Callback() {
                public void onComplete(AsyncResult result) {
                    System.out.println(result.getResponseEnvelope());
                }

                public void onError(Exception e) {
                    e.printStackTrace();
                }
            };

            //Non-Blocking Invocation
            sender = new ServiceClient();
            sender.setOptions(options);
            sender.sendReceiveNonBlocking(payload, callback);

            //Wait till the callback receives the response.
            while (!callback.isComplete()) {
                Thread.sleep(1000);
            } */

        } catch (AxisFault axisFault) {
            axisFault.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            try {
                sender.cleanup();
            } catch (AxisFault axisFault) {
                //
            }
        }
        
 

    }
    
    static class TestCallback implements  AxisCallback {

        String name = null;
        private boolean _complete = false ;
        public TestCallback ( ) {
          //      this.name = name;
        }
        public TestCallback (String name) {
                this.name = name;
          }

        public void onError (Exception e) {
                e.printStackTrace();
        }

        public void onComplete() {
             System.out.println( " message transmission complete ") ;
            _complete = true;
        }
        
        public boolean isComplete() {
            return _complete;
        }

        public void onMessage(org.apache.axis2.context.MessageContext arg0) {
        /*    System.out.println( "we received a message" ) ;
            System.out.println( "Axis message " + arg0.getAxisMessage( ) ) ;
              System.out.println( " Axis operation " + arg0.getAxisOperation( ) ) ;
              System.out.println( " Axis service " + arg0.getAxisService( ) ) ;
              System.out.println( " Current message " + arg0.getCurrentMessageContext() ) ;
               System.out.println( " InComming Trans port Name " + arg0.getIncomingTransportName() ) ;
                System.out.println( " Message ID  " + arg0.getMessageID() ) ;
                 System.out.println( " Saop Action  " + arg0.getSoapAction( ) ) ;*/
                    System.out.println( " Call Back   " + name + "got Result " + arg0.getEnvelope() ) ;
           //       onComplete( ) ;
            //throw new UnsupportedOperationException("Not supported yet.");
        }

        public void onFault(org.apache.axis2.context.MessageContext arg0) {
            
        }
        }
}


thanks & regards

akhila




> While loop doesnot exit while running echo non blocking client 
> ---------------------------------------------------------------
>
>                 Key: AXIS2-4085
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4085
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: samples
>    Affects Versions: 1.4.1
>         Environment: Windows XP Professional Vesion 2002 SP-2 , NetBeans 6.1
>            Reporter: Akhila
>            Priority: Critical
>
> public class EchoNonBlockingClient {
>     private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");
>     public static void main(String[] args) {
>         ServiceClient sender = null;
>         try {
>             OMElement payload = ClientUtil.getEchoOMElement();
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setAction("urn:echo");
>           TestCallback axisCallback = new TestCallback( " Call Back 1 "  ) ;
>              sender = new ServiceClient();
>             sender.setOptions(options);
>             sender.sendReceiveNonBlocking( payload, axisCallback );
>             //Wait till the callback receives the response.
>            while (  ! axisCallback.isComplete( ) )  {
>               Thread.sleep(1000);
>             }
> While running  this program ( echo-nonblocking client ( using axisCallback interface instead of Callback ) )  , it goes to infinite loop in     while (  ! axisCallback.isComplete( ) )  {
>               Thread.sleep(1000);
>             }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-4085) While loop doesnot exit while running echo non blocking client

Posted by "Sharath Reddy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12671772#action_12671772 ] 

Sharath Reddy commented on AXIS2-4085:
--------------------------------------

I also noticed this issue in the release 1.4.1. 

The problem is that onComplete is not being called by NonBlockingInvocationWorker when the user uses AxisCallback interface:

} finally {
                if (callback != null) {
                    callback.setComplete(true);
                }
}

When we make this change, it works:

} finally {
                if (callback != null) {
                    callback.setComplete(true);
                } else {
                	axisCallback.onComplete();
                }
}

I checked the latest Axis source code, and it looks like this has been fixed. So it should work for the next release;

http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java?r1=637413&r2=656721







> While loop doesnot exit while running echo non blocking client 
> ---------------------------------------------------------------
>
>                 Key: AXIS2-4085
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4085
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: samples
>    Affects Versions: 1.4.1
>         Environment: Windows XP Professional Vesion 2002 SP-2 , NetBeans 6.1
>            Reporter: Akhila
>            Priority: Critical
>
> public class EchoNonBlockingClient {
>     private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");
>     public static void main(String[] args) {
>         ServiceClient sender = null;
>         try {
>             OMElement payload = ClientUtil.getEchoOMElement();
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setAction("urn:echo");
>           TestCallback axisCallback = new TestCallback( " Call Back 1 "  ) ;
>              sender = new ServiceClient();
>             sender.setOptions(options);
>             sender.sendReceiveNonBlocking( payload, axisCallback );
>             //Wait till the callback receives the response.
>            while (  ! axisCallback.isComplete( ) )  {
>               Thread.sleep(1000);
>             }
> While running  this program ( echo-nonblocking client ( using axisCallback interface instead of Callback ) )  , it goes to infinite loop in     while (  ! axisCallback.isComplete( ) )  {
>               Thread.sleep(1000);
>             }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.