Hmmm ..... I think doing what you advise is too much trouble for me after all I am a newbie :)
I think I just rename the Connection inner class Thread if happen an error (yup ... changing WebServer a little bit). So I just wait for the Thread to die ... and check its name if the name indicate an error. But I have another question, One Handler uses one Thread to be processed am I correct? Thank you very much for your help.. -----Original Message----- From: Ryan Hoegg [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 11:20 PM To: [EMAIL PROTECTED] Subject: Re: [Newbie Quetion] How can I check my RPC return value If the server needs to react to an connection failure during the course of an XML-RPC call, it needs to be at the transport layer. In the WebServer class (CVS HEAD) I think this happens in the Connection inner class. I have a servlet wrapper for XmlRpcServer on my to do list somewhere, and others on the dev team have mentioned the idea as well. You should have little trouble rolling your own HTTP listener though. To get you started, the XmlRpcServer class has an execute method that takes an InputStream and returns a byte[] with the XML response to be sent to the client. Whatever code delivers the InputStream to XmlRpcServer and takes the byte[] back to the wire for the client should handle the network connection issues. Hope that helps, -- Ryan Hoegg ISIS Networks http://www.isisnetworks.net/ bagas wrote: >I am sorry but I think your answer did not help . probably because my >previous question confusing . > >Here with I'll give you another example hopefully this would be clear . > >Suppose I have a Server = > >public class TesServer { > public TesServer() { > WebServer webserver = null; > try { > webserver = new WebServer (7001); > } catch (UnknownHostException e) { > e.printStackTrace(); //To change body of catch statement >use Options | File Templates. > System.out.println("lewat"); > } > > webserver.addHandler("Something",new SomethingHandler()); > webserver.start(); > } > > public static void main(String [] args) > { > > new TesServer(); > > } > >} > >with a Handler = > >class SomethingHandler implements XmlRpcHandler >{ > public Object execute(String method, Vector params) > { > // DO SOMETHING > // CONNECTION BROKEN ........ SOMEHOW > > return params; > } >} > > >and a Client = > >public class TesXmlRPC { > > public static void main(String[] args) { > try { > > XmlRpcClient xmlrpc = new >XmlRpcClient("http://10.0.7.222:7001"); > > Vector v = new Vector(1); > v.add("TEST"); > Vector result = (Vector) xmlrpc.execute("Something.methodX", >v); > } catch (Exception e) { > e.printStackTrace(); > } > > } >} > > >Then I run my Server ... > >Then I run my Client ... > >When my client "try to" execute > >Vector result = (Vector) xmlrpc.execute("Something.methodX", v); // plz >see TesXmlRPC class > >Then the Client connect to server ..But Before the server produce any >result (so the method above not done yet) .. The connection is somehow >broken ... // see class SomethingHandler > > >Then in the Server console screen is written something like this........ >java.net.SocketException: Connection reset by peer: socket write error >// this happen because I kill the Client in the middle of executing >"xmlrpc.execute" . > >My Question is where can I catch the exception (example : >java.net.SocketException: Connection reset by peer: socket write error >) in my Server class or Handler Class? > >Is my question is clear now? If not please ask me for more information . > >Thank you ... > > > >
