From xmlrpc-user-return-1142-apmail-ws-xmlrpc-user-archive=ws.apache.org@ws.apache.org Wed Oct 13 07:05:26 2004 Return-Path: Delivered-To: apmail-ws-xmlrpc-user-archive@www.apache.org Received: (qmail 87352 invoked from network); 13 Oct 2004 07:05:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 Oct 2004 07:05:25 -0000 Received: (qmail 5761 invoked by uid 500); 13 Oct 2004 07:05:18 -0000 Delivered-To: apmail-ws-xmlrpc-user-archive@ws.apache.org Received: (qmail 5730 invoked by uid 500); 13 Oct 2004 07:05:17 -0000 Mailing-List: contact xmlrpc-user-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: xmlrpc-user@ws.apache.org Delivered-To: mailing list xmlrpc-user@ws.apache.org Received: (qmail 5703 invoked by uid 99); 13 Oct 2004 07:05:16 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of marcin@ish.com.au designates 218.214.52.22 as permitted sender) Received: from [218.214.52.22] (HELO fish.ish.com.au) (218.214.52.22) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 13 Oct 2004 00:05:13 -0700 Received: from [203.29.62.9] (helo=neuro.net.au) by fish.ish.com.au with esmtp (Exim 4.30) id 1CHd9n-0006HI-QE for xmlrpc-user@ws.apache.org; Wed, 13 Oct 2004 17:02:43 +1000 Received: from [203.29.62.188] (HELO [203.29.62.188]) by neuro.net.au (CommuniGate Pro SMTP 4.2.1) with ESMTP id 1371949 for xmlrpc-user@ws.apache.org; Wed, 13 Oct 2004 17:05:12 +1000 Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: <200410130632.i9D6Wno03985@itree.com.au> References: <200410130632.i9D6Wno03985@itree.com.au> Content-Type: multipart/alternative; boundary=Apple-Mail-3--915179328 Message-Id: <357458B8-1CE6-11D9-B0E5-000D93399EF8@ish.com.au> From: Marcin Skladaniec Subject: Re: XmlRpc Client won't die ... Date: Wed, 13 Oct 2004 17:05:04 +1000 To: xmlrpc-user@ws.apache.org X-Mailer: Apple Mail (2.619) X-Scan-Signature: 5f3cae7fb67f54d2d8ae26c0abba589f X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --Apple-Mail-3--915179328 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Thank you for this supersonic response. I will try it for sure. Thanks again Marcin Skladaniec On 13/10/2004, at 4:32 PM, Jason Wyatt wrote: > Hi Marcin, > =A0 > I=A0had a similar problem with xmlrpc, no way to set the timeout, so I = =20 > wrote a utility class to=A0add this. The other thing I wanted was for =20= > any exceptions that were caught in the thread that actually performs =20= > the xmlrpc.execute to be passed to the object that created the thread, = =20 > and then rethrown. I don't know if there was an easier way to do this, = =20 > but it seems to work OK.=A0I've been using=A0this in production on = several =20 > projects with no major problems so far. > =A0 > Code follows... forgive the lack of docco :) > =A0 > Regards > Jason > =A0 > -- > Falun Gong: A peaceful meditation practice under persecution in China > http://www.falundafa.org > > > Truth - Compassion - Forbearance > =A0 > =A0 > package common.util.xmlrpc; > =A0 > /** > =A0*

Title:=A0=A0TimedXmlRpcClient

> =A0*

Description: This XmlRpcClient simply adds a connection = timeout, =20 > after > =A0*=A0 which if the XML-RPC call did not complete, an IOException is =20= > thrown.

> =A0*

Copyright: Copyright (c) 2002

> =A0*

Company:

> =A0* @author=A0=A0Jason Wyatt > =A0* @version 1.0 > =A0*/ > > import java.util.Vector; > import java.io.IOException; > import java.net.MalformedURLException; > =A0 > import org.apache.xmlrpc.*; > =A0 > public class TimedXmlRpcClient implements Runnable > { > =A0 private XmlRpcClient xmlRpcClient; > =A0 private String hostname; > =A0 private int ip; > =A0 private int connectTimeout=3D30000; // 30 seconds default > =A0 private String remoteFunction; > =A0 private Vector params; > =A0 private Object returnValue=3Dnull; > =A0 private XmlRpcException xmlRpcException=3Dnull; > =A0 private IOException ioException=3Dnull; > =A0 private MalformedURLException malformedURLException=3Dnull; > =A0 > =A0 TimedXmlRpcClient(String hostname, int ip, int connectTimeout, =20 > String remoteFunction, Vector params) > =A0 { > =A0=A0=A0 this.hostname=3Dhostname; > =A0=A0=A0 this.ip=3Dip; > =A0=A0=A0 this.connectTimeout=3DconnectTimeout; > =A0=A0=A0 this.remoteFunction=3DremoteFunction; > =A0=A0=A0 this.params=3Dparams; > =A0 } > =A0 > =A0 > =A0public static Object execute(String hostname, int ip, int =20 > connectTimeout, String remoteFunction, Vector params) throws =20 > XmlRpcException, > =A0=A0=A0 IOException, MalformedURLException > =A0 { > =A0=A0=A0 TimedXmlRpcClient client=3Dnew =20 > TimedXmlRpcClient(hostname,ip,connectTimeout,remoteFunction,params); > =A0 > =A0=A0=A0 Thread t =3D new Thread(client); > =A0=A0=A0 t.start(); > =A0=A0=A0 try > =A0=A0=A0 { > =A0=A0=A0=A0=A0 t.join(connectTimeout); // exit the thread once it =20 > has=A0completed, or after timeout > =A0=A0=A0 } > =A0=A0=A0 catch (InterruptedException ex) > =A0=A0=A0 { > =A0=A0=A0 } > =A0 > =A0=A0=A0 // if an exception occurred while executing the remote call, = throw =20 > it again > =A0=A0=A0 // from here > =A0=A0=A0 IOException ex=3Dclient.getIOException(); > =A0=A0=A0 if(ex!=3Dnull) > =A0=A0=A0=A0=A0 throw ex; > =A0 > =A0=A0=A0 XmlRpcException ex2=3Dclient.getXmlRpcException(); > =A0=A0=A0 if(ex2!=3Dnull) > =A0=A0=A0=A0=A0 throw ex2; > =A0 > =A0=A0=A0 MalformedURLException ex3=3Dclient.getMalformedURLException();= > =A0=A0=A0 if(ex3!=3Dnull) > =A0=A0=A0=A0=A0 throw ex3; > =A0 > =A0=A0=A0 Object returnVal=3Dclient.getReturnVal(); > =A0=A0=A0 if(returnVal=3D=3Dnull) > =A0=A0=A0=A0 throw new IOException("Operation timed out"); > =A0 > =A0=A0=A0 return returnVal; > =A0 } > =A0 > =A0 > =A0 public void run() > =A0 { > =A0=A0=A0 try > =A0=A0=A0 { > =A0=A0=A0=A0=A0 xmlRpcClient=3Dnew XmlRpcClient(hostname, ip); > =A0=A0=A0=A0=A0 returnValue=3DxmlRpcClient.execute(remoteFunction, = params); > =A0=A0=A0 } > =A0=A0=A0 catch (MalformedURLException ex) > =A0=A0=A0 { > =A0=A0=A0=A0=A0 malformedURLException=3Dex; > =A0=A0=A0 } > =A0=A0=A0 catch (IOException ex2) > =A0=A0=A0 { > =A0=A0=A0=A0=A0 ioException=3Dex2; > =A0=A0=A0 } > =A0=A0=A0 catch(XmlRpcException ex3) > =A0=A0=A0 { > =A0=A0=A0=A0=A0 xmlRpcException=3Dex3; > =A0=A0=A0 } > =A0 } > =A0 > =A0 public Object getReturnVal() > =A0 { > =A0=A0=A0 return returnValue; > =A0 } > =A0 > =A0 public XmlRpcException getXmlRpcException() > =A0 { > =A0=A0=A0 return xmlRpcException; > =A0 } > =A0 > =A0 public IOException getIOException() > =A0 { > =A0=A0=A0 return ioException; > =A0 } > =A0 > =A0 public MalformedURLException getMalformedURLException() > =A0 { > =A0=A0=A0 return malformedURLException; > =A0 } > > =A0 public static void main(String[] args) > =A0 { > =A0=A0=A0 try > =A0=A0=A0 { > =A0=A0=A0=A0=A0 Vector params=3Dnew Vector(); > =A0=A0=A0=A0=A0 params.add( "select table_name from all_tables"); > =A0=A0=A0=A0=A0 =20 > = TimedXmlRpcClient.execute("localhost",32000,5,"queryHandler.sqlQuery",p=20= > arams); > =A0=A0=A0 } > =A0=A0=A0 catch (Exception ex) > =A0=A0=A0 { > =A0=A0=A0=A0=A0 System.err.println("Error=A0calling = TimedXmlRpcClient:"); > =A0=A0=A0=A0=A0 ex.printStackTrace(); > =A0=A0=A0 } > =A0 } > } > =A0 > =A0 > =A0 > =A0 > > > From: Marcin Skladaniec [mailto:marcin@ish.com.au] > Sent: Wednesday, 13 October 2004 4:02 PM > To: xmlrpc-user@ws.apache.org > Subject: XmlRpc Client won't die ... > > Hello ! > I have a XmlRpcClient executing an rpc method on very unreliable =20 > server. I have to force quit XmlRpcClient.execute() from time to time, = =20 > but I can't. I have even created a separate Thread for it, and I'm =20 > quitting the Thread after timeout. It is working but not always, when =20= > server receives xmlrpc request and freezes without any sign of life my = =20 > thread is uninterruptible. Is my approach to this problem right or am =20= > I missing something ? Does anyone created some other workaround for =20= > missing timeout in XmlRpc framework ? > > > This is the impoortant part of my code: > > > public SpacialThread(String pRemoteDatabaseURL, String pXmlRpcMethod, =20= > Vector pXmlRpcParameters) { > super(); > > xmlRpcResponse =3D null; > > xmlRpcMethod =3D pXmlRpcMethod; > xmlRpcParameters =3D pXmlRpcParameters; > // See setResponse > hasReceivedResponse =3D false; > hasBeenInterrupted =3D false; > > try { > client =3D new XmlRpcClient(pRemoteDatabaseURL); > } catch (java.net.MalformedURLException e) { > logger.error("(hash: " + hashCode() + "): =20 > java.net.MalformedURLException thrown:\n" > + e); > } > > start(); > } > > > public void run() { > try { > // This is a blocking call... > logger.debug("(hash: " + hashCode() + "): Attempting Xml Rpc =20 > transaction."); > // Set response explicitly (this should be thread safe?) > Object response =3D client.execute(xmlRpcMethod, xmlRpcParameters); > setResponse(response); > > if (isInterrupted()) { > hasBeenInterrupted =3D true; > logger.error("(hash: " + hashCode() + "): Xml Rpc transaction =20 > interrupted explicitly. Exiting. (Communication with remote =20 > abandoned)"); > } else { > logger.debug("(hash: " + hashCode() + "): Returned from Xml Rpc =20 > transaction."); > } > > } catch (Exception e) { > // Something else gone wrong... log the error and leave the exception =20= > for reference. > logger.error("(hash: " + hashCode() + "): Xml Rpc transaction =20 > interrupted abormally. Exiting. (Communication with remote =20 > abandoned)"); > setException(e); > } finally { > // Regardless of the situation, clean up and release the network =20 > resources (hopefully) > logger.debug("(hash: " + hashCode() + "): Xml Rpc transaction =20 > finilizing - releasing resources."); > client =3D null; > } > } > > Cheers > Marcin Skladaniec > --Apple-Mail-3--915179328 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Thank you for this supersonic response. I will try it for sure. Thanks again Marcin Skladaniec On 13/10/2004, at 4:32 PM, Jason Wyatt wrote: = Arial0000,0000,FFFFHi Marcin, =A0 = Arial0000,0000,FFFFI=A0had a similar problem with xmlrpc, no way to set the timeout, so I wrote a utility class to=A0add this. The other thing I wanted was for any exceptions that were caught in the thread that actually performs the xmlrpc.execute to be passed to the object that created the thread, and then rethrown. I don't know if there was an easier way to do this, but it seems to work OK.=A0I've been using=A0this in production on several projects with no major problems so far. =A0 = Arial0000,0000,FFFFCode follows... forgive the lack of docco :) =A0 = Arial0000,0000,FFFFRegards = Arial0000,0000,FFFFJason =A0 = Arial0000,0000,FFFF-- = Arial0000,0000,FFFFFalun Gong: A peaceful meditation practice under persecution in = China = Arial0000,0000,EEEEhttp://www.falundafa.org = Arial0000,0000,FFFFTruth - Compassion - Forbearance = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFFpackage common.util.xmlrpc; = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF/** = Arial0000,0000,FFFF=A0* <

Title:=A0=A0TimedXmlRpcClient<

= Arial0000,0000,FFFF=A0* <

Description: This XmlRpcClient simply adds a connection timeout, after = Arial0000,0000,FFFF=A0*=A0 which if the XML-RPC call did not complete, an IOException is thrown.<

= Arial0000,0000,FFFF=A0* <

Copyright: Copyright (c) 2002<

= Arial0000,0000,FFFF=A0* <

Company: <

= Arial0000,0000,FFFF=A0* @author=A0=A0Jason Wyatt = Arial0000,0000,FFFF=A0* @version 1.0 = Arial0000,0000,FFFF=A0*/ = Arial0000,0000,FFFFimport java.util.Vector; = Arial0000,0000,FFFFimport java.io.IOException; = Arial0000,0000,FFFFimport java.net.MalformedURLException; = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFFimport org.apache.xmlrpc.*; = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFFpublic class TimedXmlRpcClient implements = Runnable = Arial0000,0000,FFFF{ = Arial0000,0000,FFFF=A0 private XmlRpcClient xmlRpcClient; = Arial0000,0000,FFFF=A0 private String hostname; = Arial0000,0000,FFFF=A0 private int ip; = Arial0000,0000,FFFF=A0 private int connectTimeout=3D30000; // 30 seconds = default = Arial0000,0000,FFFF=A0 private String remoteFunction; = Arial0000,0000,FFFF=A0 private Vector params; = Arial0000,0000,FFFF=A0 private Object returnValue=3Dnull; = Arial0000,0000,FFFF=A0 private XmlRpcException = xmlRpcException=3Dnull; = Arial0000,0000,FFFF=A0 private IOException ioException=3Dnull; = Arial0000,0000,FFFF=A0 private MalformedURLException = malformedURLException=3Dnull; = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 TimedXmlRpcClient(String hostname, int ip, int connectTimeout, String remoteFunction, Vector params) = Arial0000,0000,FFFF=A0 { = Arial0000,0000,FFFF=A0=A0=A0 this.hostname=3Dhostname; = Arial0000,0000,FFFF=A0=A0=A0 this.ip=3Dip; = Arial0000,0000,FFFF=A0=A0=A0 this.connectTimeout=3DconnectTimeout; = Arial0000,0000,FFFF=A0=A0=A0 this.remoteFunction=3DremoteFunction; = Arial0000,0000,FFFF=A0=A0=A0 this.params=3Dparams; = Arial0000,0000,FFFF=A0 } = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0public static Object execute(String hostname, int ip, int connectTimeout, String remoteFunction, Vector params) throws = XmlRpcException, = Arial0000,0000,FFFF=A0=A0=A0 IOException, MalformedURLException = Arial0000,0000,FFFF=A0 { = Arial0000,0000,FFFF=A0=A0=A0 TimedXmlRpcClient client=3Dnew = TimedXmlRpcClient(hostname,ip,connectTimeout,remoteFunction,params); = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0=A0=A0 Thread t =3D new Thread(client); = Arial0000,0000,FFFF=A0=A0=A0 t.start(); = Arial0000,0000,FFFF=A0=A0=A0 try = Arial0000,0000,FFFF=A0=A0=A0 { = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 t.join(connectTimeout); // exit the thread once it has=A0completed, or after timeout = Arial0000,0000,FFFF=A0=A0=A0 } = Arial0000,0000,FFFF=A0=A0=A0 catch (InterruptedException ex) = Arial0000,0000,FFFF=A0=A0=A0 { = Arial0000,0000,FFFF=A0=A0=A0 } = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0=A0=A0 // if an exception occurred while executing the remote call, throw it again = Arial0000,0000,FFFF=A0=A0=A0 // from here = Arial0000,0000,FFFF=A0=A0=A0 IOException ex=3Dclient.getIOException(); = Arial0000,0000,FFFF=A0=A0=A0 if(ex!=3Dnull) = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 throw ex; = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0=A0=A0 XmlRpcException = ex2=3Dclient.getXmlRpcException(); = Arial0000,0000,FFFF=A0=A0=A0 if(ex2!=3Dnull) = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 throw ex2; = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0=A0=A0 MalformedURLException = ex3=3Dclient.getMalformedURLException(); = Arial0000,0000,FFFF=A0=A0=A0 if(ex3!=3Dnull) = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 throw ex3; = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0=A0=A0 Object returnVal=3Dclient.getReturnVal(); = Arial0000,0000,FFFF=A0=A0=A0 if(returnVal=3D=3Dnull) = Arial0000,0000,FFFF=A0=A0=A0=A0 throw new IOException("Operation timed = out"); = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0=A0=A0 return returnVal; = Arial0000,0000,FFFF=A0 } = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 public void run() = Arial0000,0000,FFFF=A0 { = Arial0000,0000,FFFF=A0=A0=A0 try = Arial0000,0000,FFFF=A0=A0=A0 { = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 xmlRpcClient=3Dnew XmlRpcClient(hostname, = ip); = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 returnValue=3DxmlRpcClient.execute(remoteFunction, = params); = Arial0000,0000,FFFF=A0=A0=A0 } = Arial0000,0000,FFFF=A0=A0=A0 catch (MalformedURLException ex) = Arial0000,0000,FFFF=A0=A0=A0 { = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 malformedURLException=3Dex; = Arial0000,0000,FFFF=A0=A0=A0 } = Arial0000,0000,FFFF=A0=A0=A0 catch (IOException ex2) = Arial0000,0000,FFFF=A0=A0=A0 { = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 ioException=3Dex2; = Arial0000,0000,FFFF=A0=A0=A0 } = Arial0000,0000,FFFF=A0=A0=A0 catch(XmlRpcException ex3) = Arial0000,0000,FFFF=A0=A0=A0 { = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 xmlRpcException=3Dex3; = Arial0000,0000,FFFF=A0=A0=A0 } = Arial0000,0000,FFFF=A0 } = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 public Object getReturnVal() = Arial0000,0000,FFFF=A0 { = Arial0000,0000,FFFF=A0=A0=A0 return returnValue; = Arial0000,0000,FFFF=A0 } = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 public XmlRpcException = getXmlRpcException() = Arial0000,0000,FFFF=A0 { = Arial0000,0000,FFFF=A0=A0=A0 return xmlRpcException; = Arial0000,0000,FFFF=A0 } = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 public IOException getIOException() = Arial0000,0000,FFFF=A0 { = Arial0000,0000,FFFF=A0=A0=A0 return ioException; = Arial0000,0000,FFFF=A0 } = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 public MalformedURLException = getMalformedURLException() = Arial0000,0000,FFFF=A0 { = Arial0000,0000,FFFF=A0=A0=A0 return malformedURLException; = Arial0000,0000,FFFF=A0 } = Arial0000,0000,FFFF=A0 public static void main(String[] args) = Arial0000,0000,FFFF=A0 { = Arial0000,0000,FFFF=A0=A0=A0 try = Arial0000,0000,FFFF=A0=A0=A0 { = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 Vector params=3Dnew Vector(); = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 params.add( "select table_name from = all_tables"); = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 = TimedXmlRpcClient.execute("localhost",32000,5,"queryHandler.sqlQuery",para= ms); = Arial0000,0000,FFFF=A0=A0=A0 } = Arial0000,0000,FFFF=A0=A0=A0 catch (Exception ex) = Arial0000,0000,FFFF=A0=A0=A0 { = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 System.err.println("Error=A0calling = TimedXmlRpcClient:"); = Arial0000,0000,FFFF=A0=A0=A0=A0=A0 ex.printStackTrace(); = Arial0000,0000,FFFF=A0=A0=A0 } = Arial0000,0000,FFFF=A0 } = Arial0000,0000,FFFF} = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 = Arial0000,0000,FFFF=A0 = Tahoma0000,0000,FFFFFrom:Ta= homa0000,0000,FFFF Marcin Skladaniec = [mailto:marcin@ish.com.au] = Tahoma0000,0000,FFFF Sent: Wednesday, 13 October 2004 4:02 = PM = Tahoma0000,0000,FFFFTo:Taho= ma0000,0000,FFFF xmlrpc-user@ws.apache.org = Tahoma0000,0000,FFFFSubject:Tahoma0000,0000,FFFF XmlRpc Client won't die ... = Arial0000,0000,FFFFHello ! = Arial0000,0000,FFFFI have a = 0000,0000,FFFF= XmlRpcClientArial0000,0000,FFFF executing an rpc method on very unreliable server. I have to force quit = 0000,0000,FFFF= XmlRpcClient.execute() from time to time, but I can't. I have even created a separate Thread for it, and I'm quitting the Thread after timeout. It is working but not always, when server receives xmlrpc request and freezes without any sign of life my thread is uninterruptible. Is my approach to this problem right or am I missing something ? Does anyone created some other workaround for missing timeout in XmlRpc framework = ? 0000,0000,FFFF This is the impoortant part of my code: 0000,0000,FFFFpublic SpacialThread(String pRemoteDatabaseURL, String pXmlRpcMethod, Vector pXmlRpcParameters) { = 0000,0000,FFFFsuper(); 0000,0000,FFFFxmlRpcResponse =3D null; 0000,0000,FFFFxmlRpcMethod =3D pXmlRpcMethod; = 0000,0000,FFFFxmlRpcParameters= =3D pXmlRpcParameters; 0000,0000,FFFF// See setResponse = 0000,0000,FFFFhasReceivedRespo= nse =3D false; = 0000,0000,FFFFhasBeenInterrupt= ed =3D false; 0000,0000,FFFFtry = { 0000,0000,FFFFclient =3D new XmlRpcClient(pRemoteDatabaseURL); 0000,0000,FFFF} catch (java.net.MalformedURLException e) { = 0000,0000,FFFFlogger.error("(h= ash: " + hashCode() + "): java.net.MalformedURLException thrown:\n" = 0000,0000,FFFF+ = e); = 0000,0000,FFFF} = 0000,0000,FFFFstart(); = 0000,0000,FFFF} 0000,0000,FFFFpublic void run() { 0000,0000,FFFFtry = { 0000,0000,FFFF// This is a blocking call... = 0000,0000,FFFFlogger.debug("(h= ash: " + hashCode() + "): Attempting Xml Rpc = transaction."); 0000,0000,FFFF// Set response explicitly (this should be thread = safe?) 0000,0000,FFFFObject response =3D client.execute(xmlRpcMethod, = xmlRpcParameters); = 0000,0000,FFFFsetResponse(resp= onse); 0000,0000,FFFFif (isInterrupted()) { = 0000,0000,FFFFhasBeenInterrupt= ed =3D true; = 0000,0000,FFFFlogger.error("(h= ash: " + hashCode() + "): Xml Rpc transaction interrupted explicitly. Exiting. (Communication with remote = abandoned)"); 0000,0000,FFFF} else = { = 0000,0000,FFFFlogger.debug("(h= ash: " + hashCode() + "): Returned from Xml Rpc = transaction."); = 0000,0000,FFFF} 0000,0000,FFFF} catch (Exception e) { 0000,0000,FFFF// Something else gone wrong... log the error and leave the exception for = reference. = 0000,0000,FFFFlogger.error("(h= ash: " + hashCode() + "): Xml Rpc transaction interrupted abormally. Exiting. (Communication with remote = abandoned)"); = 0000,0000,FFFFsetException(e);= 0000,0000,FFFF} finally = { 0000,0000,FFFF// Regardless of the situation, clean up and release the network resources (hopefully) = 0000,0000,FFFFlogger.debug("(h= ash: " + hashCode() + "): Xml Rpc transaction finilizing - releasing resources."); 0000,0000,FFFFclient =3D null; = 0000,0000,FFFF} = 0000,0000,FFFF} = 0000,0000,FFFFCheers 0000,0000,FFFFMarcin Skladaniec
= --Apple-Mail-3--915179328--