User: andd
Date: 05/04/06 11:51:38
Modified: varia/src/main/org/jboss/mq/il/http/servlet
HTTPServerILServlet.java
Log:
fix logging
Revision Changes Path
1.3 +26 -46 contrib/varia/src/main/org/jboss/mq/il/http/servlet/HTTPServerILServlet.java
Index: HTTPServerILServlet.java
===================================================================
RCS file: /cvsroot/jboss/contrib/varia/src/main/org/jboss/mq/il/http/servlet/HTTPServerILServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HTTPServerILServlet.java 27 Aug 2003 04:34:14 -0000 1.2
+++ HTTPServerILServlet.java 6 Apr 2005 18:51:37 -0000 1.3
@@ -6,45 +6,28 @@
*/
package org.jboss.mq.il.http.servlet;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-
-import javax.naming.InitialContext;
-
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.management.MBeanServer;
-import javax.management.AttributeNotFoundException;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import javax.management.MBeanException;
-import javax.management.InstanceNotFoundException;
-import javax.management.ReflectionException;
-
import org.jboss.logging.Logger;
-
import org.jboss.mq.ConnectionToken;
+import org.jboss.mq.SpyMessage;
+import org.jboss.mq.il.http.HTTPClientILStorageQueue;
import org.jboss.mq.il.http.HTTPILRequest;
import org.jboss.mq.il.http.HTTPILResponse;
-import org.jboss.mq.il.http.HTTPClientIL;
-import org.jboss.mq.il.http.HTTPClientILStorageQueue;
-
-import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.mq.server.JMSServerInvoker;
-import org.jboss.mq.SpyMessage;
+import org.jboss.mx.util.MBeanServerLocator;
/**
* This Servlet acts as a proxy to the JMS Server for the HTTP IL clients.
@@ -59,7 +42,7 @@
* the max time the request will last, before returning to the client.
*
* @author Nathan Phelps (nathan@...)
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @created January 15, 2003
*/
public class HTTPServerILServlet extends HttpServlet
@@ -88,10 +71,7 @@
{
throw new ServletException("Invoker must be specified as servlet init parameter");
}
- if (log.isDebugEnabled())
- {
- log.debug("Invoker set to '" + invokerName + ".'");
- }
+ log.debug("Invoker set to '" + invokerName + ".'");
try
{
this.invoker = (JMSServerInvoker)server.getAttribute(new ObjectName(invokerName), "Invoker");
@@ -131,17 +111,17 @@
}
String clientIlId = (String)httpIlRequest.getArguments()[0];
long timeout = ((Long)httpIlRequest.getArguments()[1]).longValue();
- if (log.isDebugEnabled())
+ if (log.isTraceEnabled())
{
- log.debug("Listening on behalf of a ClientIL #" + clientIlId + " for " + String.valueOf(timeout) + " milliseconds.");
+ log.trace("Listening on behalf of a ClientIL #" + clientIlId + " for " + String.valueOf(timeout) + " milliseconds.");
}
HTTPILRequest[] responseRequest = HTTPClientILStorageQueue.getInstance().get(clientIlId, timeout);
- if (log.isDebugEnabled())
+ if (log.isTraceEnabled())
{
- log.debug("The following lines reflect the HTTPILRequest object to be packaged and returned to ClientIL #" + clientIlId + " as an HTTPILResponse.");
+ log.trace("The following lines reflect the HTTPILRequest object to be packaged and returned to ClientIL #" + clientIlId + " as an HTTPILResponse.");
for (int i = 0; i < responseRequest.length; i++)
{
- log.debug("Response for ClientIL #" + clientIlId + " contains '" + responseRequest[i].toString() + ".'");
+ log.trace("Response for ClientIL #" + clientIlId + " contains '" + responseRequest[i].toString() + ".'");
}
}
outputStream.writeObject(new HTTPILResponse(responseRequest));
@@ -153,9 +133,9 @@
log.trace("getClientILIdentifer(HTTPILRequest " + httpIlRequest.toString() + ")");
}
String id = HTTPClientILStorageQueue.getInstance().getID();
- if (log.isDebugEnabled())
+ if (log.isTraceEnabled())
{
- log.debug("Provided ClientIL Id #" + id + ".");
+ log.trace("Provided ClientIL Id #" + id + ".");
}
outputStream.writeObject(new HTTPILResponse(id));
}
@@ -203,9 +183,9 @@
long wait = ((Long)httpIlRequest.getArguments()[2]).longValue();
SpyMessage message = this.invoker.receive(connectionToken, subscriberId, wait);
outputStream.writeObject(new HTTPILResponse(message));
- if (message != null && log.isDebugEnabled())
+ if (message != null && log.isTraceEnabled())
{
- log.debug("Returned an instance of '" + message.getClass().toString() + "' with value of '" + message.toString() + "'");
+ log.trace("Returned an instance of '" + message.getClass().toString() + "' with value of '" + message.toString() + "'");
}
}
else if (methodName.equals("setEnabled"))
@@ -238,31 +218,31 @@
}
Method method = this.invoker.getClass().getMethod(methodName, httpIlRequest.getArgumentTypes());
Object returnValue = method.invoke(this.invoker, httpIlRequest.getArguments());
- if (log.isDebugEnabled())
+ if (log.isTraceEnabled())
{
- log.debug("Invoked method '" + methodName + ".'");
+ log.trace("Invoked method '" + methodName + ".'");
}
outputStream.writeObject(new HTTPILResponse(returnValue));
- if (returnValue != null && log.isDebugEnabled())
+ if (returnValue != null && log.isTraceEnabled())
{
- log.debug("Returned an instance of '" + returnValue.getClass().toString() + "' with value of '" + returnValue.toString() + "'");
+ log.trace("Returned an instance of '" + returnValue.getClass().toString() + "' with value of '" + returnValue.toString() + "'");
}
}
}
catch (InvocationTargetException invocatonTargetException)
{
Throwable targetException = invocatonTargetException.getTargetException();
- if (log.isDebugEnabled())
+ if (log.isTraceEnabled())
{
- log.debug("The underlying invoker (i.e. The JMS Server itself) threw in exception of type '" + targetException.getClass().getName() + "' and a message of '" + targetException.getMessage() + ".' This exception is being propogated to the client as a HTTPILResponse.");
+ log.trace("The underlying invoker (i.e. The JMS Server itself) threw in exception of type '" + targetException.getClass().getName() + "' and a message of '" + targetException.getMessage() + ".' This exception is being propogated to the client as a HTTPILResponse.");
}
outputStream.writeObject(new HTTPILResponse(targetException));
}
catch (Exception exception)
{
- if (log.isDebugEnabled())
+ if (log.isTraceEnabled())
{
- log.debug("Threw an exception of type '" + exception.getClass().getName() + "' with a message of '" + exception.getMessage() + ".' This exception is being propogated to the client as a HTTPILResponse.");
+ log.trace("Threw an exception of type '" + exception.getClass().getName() + "' with a message of '" + exception.getMessage() + ".' This exception is being propogated to the client as a HTTPILResponse.");
}
outputStream.writeObject(new HTTPILResponse(exception));
}
|