[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/marshal ...
Tom Elrod
tom.elrod at jboss.com
Wed Aug 16 10:20:16 EDT 2006
User: telrod
Date: 06/08/16 10:20:16
Modified: src/main/org/jboss/remoting/marshal MarshalFactory.java
Log:
JBREM-562 - pulling out some logging for performance boost.
Revision Changes Path
1.16 +40 -15 JBossRemoting/src/main/org/jboss/remoting/marshal/MarshalFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MarshalFactory.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/marshal/MarshalFactory.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- MarshalFactory.java 4 Jan 2006 14:42:51 -0000 1.15
+++ MarshalFactory.java 16 Aug 2006 14:20:16 -0000 1.16
@@ -22,8 +22,6 @@
package org.jboss.remoting.marshal;
-import java.util.HashMap;
-import java.util.Map;
import org.jboss.logging.Logger;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.marshal.http.HTTPMarshaller;
@@ -33,6 +31,9 @@
import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* This class will provide marshallers and unmarshallers for data based on
@@ -52,6 +53,9 @@
protected final static Logger log = Logger.getLogger(MarshalFactory.class);
+ private final static boolean isTrace = log.isTraceEnabled();
+ private final static boolean isDebug = log.isDebugEnabled();
+
// statically load core marshallers/unmarshallers
static
{
@@ -123,8 +127,11 @@
}
else
{
+ if(isDebug)
+ {
log.debug("Could not find marshaller for class type '" + classType + "'. Object in collection is " + obj);
}
+ }
return marshaller;
}
@@ -171,8 +178,11 @@
}
else
{
+ if(isDebug)
+ {
log.debug("Could not find unmarshaller for class type '" + classType + "'. Object in collection is " + obj);
}
+ }
return unmarshaller;
}
@@ -213,8 +223,11 @@
}
else
{
+ if(isDebug)
+ {
log.debug("Could not find marshaller for data type '" + dataType + "'. Object in collection is " + obj);
}
+ }
return marshaller;
}
@@ -268,8 +281,11 @@
}
else
{
+ if(isDebug)
+ {
log.debug("Could not find unmarshaller for data type '" + dataType + "'. Object in collection is " + obj);
}
+ }
return unmarshaller;
}
@@ -307,7 +323,7 @@
}
if(marshaller == null)
{
- if(log.isTraceEnabled())
+ if(isTrace)
{
log.trace("Could not look up marshaller by data type ('" + dataType + "'). Will try to load dynamically.");
}
@@ -317,7 +333,10 @@
marshaller = loadMarshaller(marshallerFQN);
if(marshaller != null)
{
- log.debug("Found marshaller by loading locally.");
+ if(isTrace)
+ {
+ log.trace("Found marshaller by loading locally.");
+ }
// try to load unmarshaller so that can add to list
String unmarshallerFQN = (String) params.get(InvokerLocator.UNMARSHALLER);
UnMarshaller unmarshaller = loadUnMarshaller(unmarshallerFQN);
@@ -327,9 +346,9 @@
}
}
}
- if(marshaller == null)
+ if(marshaller == null && isTrace)
{
- log.debug("Tried to find marshaller from locator by both data type and class name but was unsuccessful. " +
+ log.trace("Tried to find marshaller from locator by both data type and class name but was unsuccessful. " +
"Will try to load it from remote server.");
}
// if still have not found marshaller, check to see if can load remotely
@@ -344,8 +363,11 @@
{
unmarshaller.setClassLoader(classLoader);
}
+ if(isDebug)
+ {
log.debug("Remotely loaded marshaller: " + marshaller);
log.debug("Remotely loaded unmarshaller: " + unmarshaller);
+ }
if(marshaller != null && unmarshaller != null)
{
addMarshaller(dataType, marshaller, unmarshaller);
@@ -426,7 +448,10 @@
}
if(unmarshaller == null)
{
+ if(isDebug)
+ {
log.debug("Could not find unmarshaller by data type ('" + dataType + "'). Will try to load dynamically.");
+ }
// will now look for explicit param for marshaller class
String unmarshallerFQN = (String) params.get(InvokerLocator.UNMARSHALLER);
@@ -441,7 +466,7 @@
}
}
}
- if(log.isTraceEnabled() && unmarshaller == null)
+ if(isTrace && unmarshaller == null)
{
log.trace("Tried to find unmarshaller from locator by both data type and class name but was unsuccessful.");
}
@@ -455,7 +480,7 @@
unmarshaller.setClassLoader(classLoader);
}
Marshaller marshaller = MarshallerLoaderClient.getMarshaller(loaderLocator, dataType, classLoader);
- if(log.isTraceEnabled())
+ if(isTrace)
{
log.trace("Remotely loaded marshaller: " + marshaller);
log.trace("Remotely loaded unmarshaller: " + unmarshaller);
More information about the jboss-cvs-commits
mailing list