jon 02/02/19 15:05:05
Modified: src/java/org/apache/xmlrpc XmlRpcServer.java
Log:
removed call to System.currentTimeMillis() unless debugging is on
don't use a "".getBytes() to get an empty byte[], pre-allocate it as a static
minor code cleanup
-jon
Revision Changes Path
1.17 +16 -10 xml-rpc/src/java/org/apache/xmlrpc/XmlRpcServer.java
Index: XmlRpcServer.java
===================================================================
RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcServer.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XmlRpcServer.java 19 Feb 2002 22:47:27 -0000 1.16
+++ XmlRpcServer.java 19 Feb 2002 23:05:05 -0000 1.17
@@ -70,7 +70,10 @@
*/
public class XmlRpcServer
{
- Hashtable handlers;
+ private Hashtable handlers;
+ private Stack pool;
+ private int workers;
+ static final byte[] EMPTY_BYTE_ARRAY = new byte[]{};
/**
* Construct a new XML-RPC server. You have to register handlers
@@ -79,6 +82,8 @@
public XmlRpcServer()
{
handlers = new Hashtable();
+ pool = new Stack();
+ workers = 0;
}
/**
@@ -139,9 +144,6 @@
return retval;
}
- Stack pool = new Stack();
- int workers = 0;
-
private final Worker getWorker()
{
try
@@ -205,15 +207,19 @@
String password)
{
byte[] result;
- long now = System.currentTimeMillis();
-
+ long now = 0;
+
+ if (XmlRpc.debug)
+ {
+ now = System.currentTimeMillis();
+ }
try
{
parse(is);
if (XmlRpc.debug)
{
- System.err.println("method name: "+methodName);
- System.err.println("inparams: "+inParams);
+ System.err.println("method name: " + methodName);
+ System.err.println("inparams: " + inParams);
}
// check for errors from the XML parser
if (errorLevel > NONE)
@@ -329,7 +335,7 @@
}
else
{
- result = "".getBytes();
+ result = EMPTY_BYTE_ARRAY;
}
}
finally
@@ -520,7 +526,7 @@
Throwable t = it_e.getTargetException();
if (t instanceof XmlRpcException)
{
- throw(XmlRpcException) t;
+ throw (XmlRpcException) t;
}
// It is some other exception
throw new Exception(t.toString());