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 "rnell (JIRA)" <ji...@apache.org> on 2006/04/13 20:16:00 UTC

[jira] Created: (AXIS2-572) Callback timeout incorrectly reported as an AxisFault( null )

Callback timeout incorrectly reported as an AxisFault( null )
-------------------------------------------------------------

         Key: AXIS2-572
         URL: http://issues.apache.org/jira/browse/AXIS2-572
     Project: Apache Axis 2.0 (Axis2)
        Type: Bug

  Components: client-api  
    Versions: 0.95    
    Reporter: rnell


The code in ServiceClient.java:418 that waits for a callback reply throws a generic AxisFault( null ) when there is a timeout. Would expect a "responseTimeOut" exception. 

Also the callback.wait( timeout ) can end prematurely and that situation needs to be handled, see the javadoc for Object.wait(long timeout):


Current code in ServiceClient.java:418
	 long timeout = options.getTimeOutInMilliSeconds();
	 synchronized (callback) {
		  try {
				callback.wait(timeout);
		  } catch (InterruptedException e) {
				throw new AxisFault(Messages
						  .getMessage("responseTimeOut"));
		  }
	 }
 	 // process the resule of the invocation
	 if (callback.envelope != null) {
		  // building soap enevlop
		  callback.envelope.build();
		  // closing tranport
		  return callback.envelope.getBody().getFirstElement();
	 } else {
		  if (callback.error instanceof AxisFault) {
				throw (AxisFault) callback.error;
		  } else {
				throw new AxisFault(callback.error);
		  }
	 }
	 
Suggested code:
	 long timeout = options.getTimeOutInMilliSeconds();
*	 long waitTime = timeout;
*	 long startTime = System.currentTimeMillis();

	 synchronized (callback) {
*		  while( ! callback.isComplete() && waitTime >= 0 ) {
				try {
					 callback.wait(timeout);
				} catch (InterruptedException e) {
*					 // We were interrupted for some reason, keep waiting
*					 // or throw new AxisFault( "Callback was interrupted by someone?" );
				}
*				// The wait finished, compute remaining time
*				// - wait can end prematurly, see Object.wait( int timeout )
*				waitTime = timeout - ( System.currentTimeMillis() - startTime );
		  }
	 }

	 // process the resule of the invocation
	 if (callback.envelope != null) {
		  // building soap enevlop
		  callback.envelope.build();
		  // closing tranport
		  return callback.envelope.getBody().getFirstElement();
	 } else {
		  if (callback.error instanceof AxisFault) {
				throw (AxisFault) callback.error;
		  } else if( callback.error != null ) {
				throw new AxisFault(callback.error);
*		  } else if( ! callback.isComplete() ) {
*				throw new AxisFault(Messages.getMessage( "responseTimeOut" ) );
*		  } else
*				throw new AxisFault( "Callback completed but there was no envelope or error" );
 }
 
 
This change is necessary because we are quering the isComplete() above.  
Shouldn't call notify() until the setComplete() has been called.
Current code in ServiceClient.java:594.
    public void onComplete(AsyncResult result) {
		  this.envelope = result.getResponseEnvelope();
		  this.msgctx = result.getResponseMessageContext();
		  synchronized (this) {
				notify();
		  }
	 }



Suggested code in CallbackReceiver:35 
	 public void onComplete(AsyncResult result) {
		  this.envelope = result.getResponseEnvelope();
		  this.msgctx = result.getResponseMessageContext();
*	 }

*	 public void setComplete( boolean complete ) {
*		  super.setComplete( complete );
*		  synchronized (this) {
*				notify();
*		  }
*	 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS2-572) Callback timeout incorrectly reported as an AxisFault( null )

Posted by "rnell (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-572?page=all ]

rnell updated AXIS2-572:
------------------------

    Attachment: ServiceClient.diff

Includes change to SyncCallback class

> Callback timeout incorrectly reported as an AxisFault( null )
> -------------------------------------------------------------
>
>          Key: AXIS2-572
>          URL: http://issues.apache.org/jira/browse/AXIS2-572
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: client-api
>     Versions: 0.95
>     Reporter: rnell
>  Attachments: ServiceClient.diff, ServiceClient.diff
>
> The code in ServiceClient.java:418 that waits for a callback reply throws a generic AxisFault( null ) when there is a timeout. Would expect a "responseTimeOut" exception. 
> Also the callback.wait( timeout ) can end prematurely and that situation needs to be handled, see the javadoc for Object.wait(long timeout):
> Current code in ServiceClient.java:418
> 	 long timeout = options.getTimeOutInMilliSeconds();
> 	 synchronized (callback) {
> 		  try {
> 				callback.wait(timeout);
> 		  } catch (InterruptedException e) {
> 				throw new AxisFault(Messages
> 						  .getMessage("responseTimeOut"));
> 		  }
> 	 }
>  	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else {
> 				throw new AxisFault(callback.error);
> 		  }
> 	 }
> 	 
> Suggested code:
> 	 long timeout = options.getTimeOutInMilliSeconds();
> *	 long waitTime = timeout;
> *	 long startTime = System.currentTimeMillis();
> 	 synchronized (callback) {
> *		  while( ! callback.isComplete() && waitTime >= 0 ) {
> 				try {
> 					 callback.wait(timeout);
> 				} catch (InterruptedException e) {
> *					 // We were interrupted for some reason, keep waiting
> *					 // or throw new AxisFault( "Callback was interrupted by someone?" );
> 				}
> *				// The wait finished, compute remaining time
> *				// - wait can end prematurly, see Object.wait( int timeout )
> *				waitTime = timeout - ( System.currentTimeMillis() - startTime );
> 		  }
> 	 }
> 	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else if( callback.error != null ) {
> 				throw new AxisFault(callback.error);
> *		  } else if( ! callback.isComplete() ) {
> *				throw new AxisFault(Messages.getMessage( "responseTimeOut" ) );
> *		  } else
> *				throw new AxisFault( "Callback completed but there was no envelope or error" );
>  }
>  
>  
> This change is necessary because we are quering the isComplete() above.  
> Shouldn't call notify() until the setComplete() has been called.
> Current code in ServiceClient.java:594.
>     public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> 		  synchronized (this) {
> 				notify();
> 		  }
> 	 }
> Suggested code in CallbackReceiver:35 
> 	 public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> *	 }
> *	 public void setComplete( boolean complete ) {
> *		  super.setComplete( complete );
> *		  synchronized (this) {
> *				notify();
> *		  }
> *	 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (AXIS2-572) Callback timeout incorrectly reported as an AxisFault( null )

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-572?page=all ]

Deepal Jayasinghe reassigned AXIS2-572:
---------------------------------------

    Assign To: Deepal Jayasinghe

> Callback timeout incorrectly reported as an AxisFault( null )
> -------------------------------------------------------------
>
>          Key: AXIS2-572
>          URL: http://issues.apache.org/jira/browse/AXIS2-572
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: client-api
>     Versions: 0.95
>     Reporter: rnell
>     Assignee: Deepal Jayasinghe
>  Attachments: ServiceClient.diff, ServiceClient.diff
>
> The code in ServiceClient.java:418 that waits for a callback reply throws a generic AxisFault( null ) when there is a timeout. Would expect a "responseTimeOut" exception. 
> Also the callback.wait( timeout ) can end prematurely and that situation needs to be handled, see the javadoc for Object.wait(long timeout):
> Current code in ServiceClient.java:418
> 	 long timeout = options.getTimeOutInMilliSeconds();
> 	 synchronized (callback) {
> 		  try {
> 				callback.wait(timeout);
> 		  } catch (InterruptedException e) {
> 				throw new AxisFault(Messages
> 						  .getMessage("responseTimeOut"));
> 		  }
> 	 }
>  	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else {
> 				throw new AxisFault(callback.error);
> 		  }
> 	 }
> 	 
> Suggested code:
> 	 long timeout = options.getTimeOutInMilliSeconds();
> *	 long waitTime = timeout;
> *	 long startTime = System.currentTimeMillis();
> 	 synchronized (callback) {
> *		  while( ! callback.isComplete() && waitTime >= 0 ) {
> 				try {
> 					 callback.wait(timeout);
> 				} catch (InterruptedException e) {
> *					 // We were interrupted for some reason, keep waiting
> *					 // or throw new AxisFault( "Callback was interrupted by someone?" );
> 				}
> *				// The wait finished, compute remaining time
> *				// - wait can end prematurly, see Object.wait( int timeout )
> *				waitTime = timeout - ( System.currentTimeMillis() - startTime );
> 		  }
> 	 }
> 	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else if( callback.error != null ) {
> 				throw new AxisFault(callback.error);
> *		  } else if( ! callback.isComplete() ) {
> *				throw new AxisFault(Messages.getMessage( "responseTimeOut" ) );
> *		  } else
> *				throw new AxisFault( "Callback completed but there was no envelope or error" );
>  }
>  
>  
> This change is necessary because we are quering the isComplete() above.  
> Shouldn't call notify() until the setComplete() has been called.
> Current code in ServiceClient.java:594.
>     public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> 		  synchronized (this) {
> 				notify();
> 		  }
> 	 }
> Suggested code in CallbackReceiver:35 
> 	 public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> *	 }
> *	 public void setComplete( boolean complete ) {
> *		  super.setComplete( complete );
> *		  synchronized (this) {
> *				notify();
> *		  }
> *	 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS2-572) Callback timeout incorrectly reported as an AxisFault( null )

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-572?page=comments#action_12374912 ] 

Deepal Jayasinghe commented on AXIS2-572:
-----------------------------------------

I just went though your patch and realized that the wile loop will kill the CPU power , we had the somewhat similar mechanism sometimes ago. Since that kill the CPU utilization we came up with what we have now , as I know sendReceive  with two channel is not that common situation. 

Thank you very much for sending such a patch , I think we need some more advice before applying this.


> Callback timeout incorrectly reported as an AxisFault( null )
> -------------------------------------------------------------
>
>          Key: AXIS2-572
>          URL: http://issues.apache.org/jira/browse/AXIS2-572
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: client-api
>     Versions: 0.95
>     Reporter: rnell
>  Attachments: ServiceClient.diff, ServiceClient.diff
>
> The code in ServiceClient.java:418 that waits for a callback reply throws a generic AxisFault( null ) when there is a timeout. Would expect a "responseTimeOut" exception. 
> Also the callback.wait( timeout ) can end prematurely and that situation needs to be handled, see the javadoc for Object.wait(long timeout):
> Current code in ServiceClient.java:418
> 	 long timeout = options.getTimeOutInMilliSeconds();
> 	 synchronized (callback) {
> 		  try {
> 				callback.wait(timeout);
> 		  } catch (InterruptedException e) {
> 				throw new AxisFault(Messages
> 						  .getMessage("responseTimeOut"));
> 		  }
> 	 }
>  	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else {
> 				throw new AxisFault(callback.error);
> 		  }
> 	 }
> 	 
> Suggested code:
> 	 long timeout = options.getTimeOutInMilliSeconds();
> *	 long waitTime = timeout;
> *	 long startTime = System.currentTimeMillis();
> 	 synchronized (callback) {
> *		  while( ! callback.isComplete() && waitTime >= 0 ) {
> 				try {
> 					 callback.wait(timeout);
> 				} catch (InterruptedException e) {
> *					 // We were interrupted for some reason, keep waiting
> *					 // or throw new AxisFault( "Callback was interrupted by someone?" );
> 				}
> *				// The wait finished, compute remaining time
> *				// - wait can end prematurly, see Object.wait( int timeout )
> *				waitTime = timeout - ( System.currentTimeMillis() - startTime );
> 		  }
> 	 }
> 	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else if( callback.error != null ) {
> 				throw new AxisFault(callback.error);
> *		  } else if( ! callback.isComplete() ) {
> *				throw new AxisFault(Messages.getMessage( "responseTimeOut" ) );
> *		  } else
> *				throw new AxisFault( "Callback completed but there was no envelope or error" );
>  }
>  
>  
> This change is necessary because we are quering the isComplete() above.  
> Shouldn't call notify() until the setComplete() has been called.
> Current code in ServiceClient.java:594.
>     public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> 		  synchronized (this) {
> 				notify();
> 		  }
> 	 }
> Suggested code in CallbackReceiver:35 
> 	 public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> *	 }
> *	 public void setComplete( boolean complete ) {
> *		  super.setComplete( complete );
> *		  synchronized (this) {
> *				notify();
> *		  }
> *	 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXIS2-572) Callback timeout incorrectly reported as an AxisFault( null )

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-572?page=all ]
     
Deepal Jayasinghe resolved AXIS2-572:
-------------------------------------

    Resolution: Fixed

Applied the patch , the problem was I had not understand the patch correctly , I am sorry for that and thx for the patch

> Callback timeout incorrectly reported as an AxisFault( null )
> -------------------------------------------------------------
>
>          Key: AXIS2-572
>          URL: http://issues.apache.org/jira/browse/AXIS2-572
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: client-api
>     Versions: 0.95
>     Reporter: rnell
>     Assignee: Deepal Jayasinghe
>  Attachments: ServiceClient.diff, ServiceClient.diff
>
> The code in ServiceClient.java:418 that waits for a callback reply throws a generic AxisFault( null ) when there is a timeout. Would expect a "responseTimeOut" exception. 
> Also the callback.wait( timeout ) can end prematurely and that situation needs to be handled, see the javadoc for Object.wait(long timeout):
> Current code in ServiceClient.java:418
> 	 long timeout = options.getTimeOutInMilliSeconds();
> 	 synchronized (callback) {
> 		  try {
> 				callback.wait(timeout);
> 		  } catch (InterruptedException e) {
> 				throw new AxisFault(Messages
> 						  .getMessage("responseTimeOut"));
> 		  }
> 	 }
>  	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else {
> 				throw new AxisFault(callback.error);
> 		  }
> 	 }
> 	 
> Suggested code:
> 	 long timeout = options.getTimeOutInMilliSeconds();
> *	 long waitTime = timeout;
> *	 long startTime = System.currentTimeMillis();
> 	 synchronized (callback) {
> *		  while( ! callback.isComplete() && waitTime >= 0 ) {
> 				try {
> 					 callback.wait(timeout);
> 				} catch (InterruptedException e) {
> *					 // We were interrupted for some reason, keep waiting
> *					 // or throw new AxisFault( "Callback was interrupted by someone?" );
> 				}
> *				// The wait finished, compute remaining time
> *				// - wait can end prematurly, see Object.wait( int timeout )
> *				waitTime = timeout - ( System.currentTimeMillis() - startTime );
> 		  }
> 	 }
> 	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else if( callback.error != null ) {
> 				throw new AxisFault(callback.error);
> *		  } else if( ! callback.isComplete() ) {
> *				throw new AxisFault(Messages.getMessage( "responseTimeOut" ) );
> *		  } else
> *				throw new AxisFault( "Callback completed but there was no envelope or error" );
>  }
>  
>  
> This change is necessary because we are quering the isComplete() above.  
> Shouldn't call notify() until the setComplete() has been called.
> Current code in ServiceClient.java:594.
>     public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> 		  synchronized (this) {
> 				notify();
> 		  }
> 	 }
> Suggested code in CallbackReceiver:35 
> 	 public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> *	 }
> *	 public void setComplete( boolean complete ) {
> *		  super.setComplete( complete );
> *		  synchronized (this) {
> *				notify();
> *		  }
> *	 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS2-572) Callback timeout incorrectly reported as an AxisFault( null )

Posted by "rnell (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-572?page=all ]

rnell updated AXIS2-572:
------------------------

    Attachment: ServiceClient.diff

Diff attached.

> Callback timeout incorrectly reported as an AxisFault( null )
> -------------------------------------------------------------
>
>          Key: AXIS2-572
>          URL: http://issues.apache.org/jira/browse/AXIS2-572
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: client-api
>     Versions: 0.95
>     Reporter: rnell
>  Attachments: ServiceClient.diff
>
> The code in ServiceClient.java:418 that waits for a callback reply throws a generic AxisFault( null ) when there is a timeout. Would expect a "responseTimeOut" exception. 
> Also the callback.wait( timeout ) can end prematurely and that situation needs to be handled, see the javadoc for Object.wait(long timeout):
> Current code in ServiceClient.java:418
> 	 long timeout = options.getTimeOutInMilliSeconds();
> 	 synchronized (callback) {
> 		  try {
> 				callback.wait(timeout);
> 		  } catch (InterruptedException e) {
> 				throw new AxisFault(Messages
> 						  .getMessage("responseTimeOut"));
> 		  }
> 	 }
>  	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else {
> 				throw new AxisFault(callback.error);
> 		  }
> 	 }
> 	 
> Suggested code:
> 	 long timeout = options.getTimeOutInMilliSeconds();
> *	 long waitTime = timeout;
> *	 long startTime = System.currentTimeMillis();
> 	 synchronized (callback) {
> *		  while( ! callback.isComplete() && waitTime >= 0 ) {
> 				try {
> 					 callback.wait(timeout);
> 				} catch (InterruptedException e) {
> *					 // We were interrupted for some reason, keep waiting
> *					 // or throw new AxisFault( "Callback was interrupted by someone?" );
> 				}
> *				// The wait finished, compute remaining time
> *				// - wait can end prematurly, see Object.wait( int timeout )
> *				waitTime = timeout - ( System.currentTimeMillis() - startTime );
> 		  }
> 	 }
> 	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else if( callback.error != null ) {
> 				throw new AxisFault(callback.error);
> *		  } else if( ! callback.isComplete() ) {
> *				throw new AxisFault(Messages.getMessage( "responseTimeOut" ) );
> *		  } else
> *				throw new AxisFault( "Callback completed but there was no envelope or error" );
>  }
>  
>  
> This change is necessary because we are quering the isComplete() above.  
> Shouldn't call notify() until the setComplete() has been called.
> Current code in ServiceClient.java:594.
>     public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> 		  synchronized (this) {
> 				notify();
> 		  }
> 	 }
> Suggested code in CallbackReceiver:35 
> 	 public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> *	 }
> *	 public void setComplete( boolean complete ) {
> *		  super.setComplete( complete );
> *		  synchronized (this) {
> *				notify();
> *		  }
> *	 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS2-572) Callback timeout incorrectly reported as an AxisFault( null )

Posted by "rnell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-572?page=comments#action_12374918 ] 

rnell commented on AXIS2-572:
-----------------------------

It has been my experience is that the looping in the while-loop almost never happens, the wait() completes due to a notify() or timeout, and there is no CPU performance issue.   

We are very interested in Axis2 because of the JMS support and the async features.  Take this feature away, or lessen it's importance and we likely be in axis1.x camp.


> Callback timeout incorrectly reported as an AxisFault( null )
> -------------------------------------------------------------
>
>          Key: AXIS2-572
>          URL: http://issues.apache.org/jira/browse/AXIS2-572
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: client-api
>     Versions: 0.95
>     Reporter: rnell
>     Assignee: Deepal Jayasinghe
>  Attachments: ServiceClient.diff, ServiceClient.diff
>
> The code in ServiceClient.java:418 that waits for a callback reply throws a generic AxisFault( null ) when there is a timeout. Would expect a "responseTimeOut" exception. 
> Also the callback.wait( timeout ) can end prematurely and that situation needs to be handled, see the javadoc for Object.wait(long timeout):
> Current code in ServiceClient.java:418
> 	 long timeout = options.getTimeOutInMilliSeconds();
> 	 synchronized (callback) {
> 		  try {
> 				callback.wait(timeout);
> 		  } catch (InterruptedException e) {
> 				throw new AxisFault(Messages
> 						  .getMessage("responseTimeOut"));
> 		  }
> 	 }
>  	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else {
> 				throw new AxisFault(callback.error);
> 		  }
> 	 }
> 	 
> Suggested code:
> 	 long timeout = options.getTimeOutInMilliSeconds();
> *	 long waitTime = timeout;
> *	 long startTime = System.currentTimeMillis();
> 	 synchronized (callback) {
> *		  while( ! callback.isComplete() && waitTime >= 0 ) {
> 				try {
> 					 callback.wait(timeout);
> 				} catch (InterruptedException e) {
> *					 // We were interrupted for some reason, keep waiting
> *					 // or throw new AxisFault( "Callback was interrupted by someone?" );
> 				}
> *				// The wait finished, compute remaining time
> *				// - wait can end prematurly, see Object.wait( int timeout )
> *				waitTime = timeout - ( System.currentTimeMillis() - startTime );
> 		  }
> 	 }
> 	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else if( callback.error != null ) {
> 				throw new AxisFault(callback.error);
> *		  } else if( ! callback.isComplete() ) {
> *				throw new AxisFault(Messages.getMessage( "responseTimeOut" ) );
> *		  } else
> *				throw new AxisFault( "Callback completed but there was no envelope or error" );
>  }
>  
>  
> This change is necessary because we are quering the isComplete() above.  
> Shouldn't call notify() until the setComplete() has been called.
> Current code in ServiceClient.java:594.
>     public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> 		  synchronized (this) {
> 				notify();
> 		  }
> 	 }
> Suggested code in CallbackReceiver:35 
> 	 public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> *	 }
> *	 public void setComplete( boolean complete ) {
> *		  super.setComplete( complete );
> *		  synchronized (this) {
> *				notify();
> *		  }
> *	 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS2-572) Callback timeout incorrectly reported as an AxisFault( null )

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-572?page=comments#action_12374567 ] 

Davanum Srinivas commented on AXIS2-572:
----------------------------------------

rnell,

Could u please submit a "svn diff" against latest sources?

thanks,
dims

> Callback timeout incorrectly reported as an AxisFault( null )
> -------------------------------------------------------------
>
>          Key: AXIS2-572
>          URL: http://issues.apache.org/jira/browse/AXIS2-572
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: client-api
>     Versions: 0.95
>     Reporter: rnell

>
> The code in ServiceClient.java:418 that waits for a callback reply throws a generic AxisFault( null ) when there is a timeout. Would expect a "responseTimeOut" exception. 
> Also the callback.wait( timeout ) can end prematurely and that situation needs to be handled, see the javadoc for Object.wait(long timeout):
> Current code in ServiceClient.java:418
> 	 long timeout = options.getTimeOutInMilliSeconds();
> 	 synchronized (callback) {
> 		  try {
> 				callback.wait(timeout);
> 		  } catch (InterruptedException e) {
> 				throw new AxisFault(Messages
> 						  .getMessage("responseTimeOut"));
> 		  }
> 	 }
>  	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else {
> 				throw new AxisFault(callback.error);
> 		  }
> 	 }
> 	 
> Suggested code:
> 	 long timeout = options.getTimeOutInMilliSeconds();
> *	 long waitTime = timeout;
> *	 long startTime = System.currentTimeMillis();
> 	 synchronized (callback) {
> *		  while( ! callback.isComplete() && waitTime >= 0 ) {
> 				try {
> 					 callback.wait(timeout);
> 				} catch (InterruptedException e) {
> *					 // We were interrupted for some reason, keep waiting
> *					 // or throw new AxisFault( "Callback was interrupted by someone?" );
> 				}
> *				// The wait finished, compute remaining time
> *				// - wait can end prematurly, see Object.wait( int timeout )
> *				waitTime = timeout - ( System.currentTimeMillis() - startTime );
> 		  }
> 	 }
> 	 // process the resule of the invocation
> 	 if (callback.envelope != null) {
> 		  // building soap enevlop
> 		  callback.envelope.build();
> 		  // closing tranport
> 		  return callback.envelope.getBody().getFirstElement();
> 	 } else {
> 		  if (callback.error instanceof AxisFault) {
> 				throw (AxisFault) callback.error;
> 		  } else if( callback.error != null ) {
> 				throw new AxisFault(callback.error);
> *		  } else if( ! callback.isComplete() ) {
> *				throw new AxisFault(Messages.getMessage( "responseTimeOut" ) );
> *		  } else
> *				throw new AxisFault( "Callback completed but there was no envelope or error" );
>  }
>  
>  
> This change is necessary because we are quering the isComplete() above.  
> Shouldn't call notify() until the setComplete() has been called.
> Current code in ServiceClient.java:594.
>     public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> 		  synchronized (this) {
> 				notify();
> 		  }
> 	 }
> Suggested code in CallbackReceiver:35 
> 	 public void onComplete(AsyncResult result) {
> 		  this.envelope = result.getResponseEnvelope();
> 		  this.msgctx = result.getResponseMessageContext();
> *	 }
> *	 public void setComplete( boolean complete ) {
> *		  super.setComplete( complete );
> *		  synchronized (this) {
> *				notify();
> *		  }
> *	 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira