[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...
Ovidiu Feodorov
ovidiu.feodorov at jboss.com
Sat Jan 13 07:42:34 EST 2007
User: ovidiu
Date: 07/01/13 07:42:34
Modified: src/main/org/jboss/remoting Tag: remoting_2_x
AbstractInvoker.java InvocationRequest.java
InvocationResponse.java
MicroRemoteClientInvoker.java ServerInvoker.java
Log:
Various logging improvments, minor reformatting and new tests in preparation
for a solution for http://jira.jboss.org/jira/browse/JBREM-666.
Includes http://jira.jboss.org/jira/browse/JBREM-667.
Revision Changes Path
No revision
No revision
1.12.4.7 +4 -11 JBossRemoting/src/main/org/jboss/remoting/AbstractInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/AbstractInvoker.java,v
retrieving revision 1.12.4.6
retrieving revision 1.12.4.7
diff -u -b -r1.12.4.6 -r1.12.4.7
--- AbstractInvoker.java 11 Jan 2007 20:34:50 -0000 1.12.4.6
+++ AbstractInvoker.java 13 Jan 2007 12:42:34 -0000 1.12.4.7
@@ -48,11 +48,12 @@
*
* @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
* @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
- * @version $Revision: 1.12.4.6 $
+ * @version $Revision: 1.12.4.7 $
*/
public abstract class AbstractInvoker implements Invoker
{
- protected final Logger log = Logger.getLogger(getClass());
+ private static final Logger log = Logger.getLogger(AbstractInvoker.class);
+
protected ClassByteClassLoader classbyteloader;
protected InvokerLocator locator;
protected Map localServerLocators = new HashMap();
@@ -104,8 +105,6 @@
/**
* return the locator this Invoker represents
- *
- * @return
*/
public InvokerLocator getLocator()
{
@@ -152,8 +151,6 @@
/**
* Gets the client locator. This locator will be used by the server side
* to make callbacks to the handler for this locator.
- *
- * @return
*/
public InvokerLocator getClientLocator(String listenerId)
{
@@ -247,11 +244,7 @@
}
/**
- * If any configuration parameters relate to the construction of a SSLSocketBuilder,
- * create one.
- *
- * @param configuration
- * @return
+ * If any configuration parameters relate to the construction of a SSLSocketBuilder, create one.
*/
protected SocketFactory createSocketFactory(Map configuration)
{
1.3.10.1 +6 -1 JBossRemoting/src/main/org/jboss/remoting/InvocationRequest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvocationRequest.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/InvocationRequest.java,v
retrieving revision 1.3
retrieving revision 1.3.10.1
diff -u -b -r1.3 -r1.3.10.1
--- InvocationRequest.java 30 Dec 2005 05:26:38 -0000 1.3
+++ InvocationRequest.java 13 Jan 2007 12:42:34 -0000 1.3.10.1
@@ -30,7 +30,7 @@
* unmarshalled method invocation parameters from the ServerInvoker.
*
* @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.3.10.1 $
*/
//TODO: Need to remove Serializable if not going to pass InvocationRequest as the callback object -TME
public class InvocationRequest implements Serializable
@@ -119,4 +119,9 @@
{
this.returnPayload = returnPayload;
}
+
+ public String toString()
+ {
+ return "InvocationRequest[" + Integer.toHexString(hashCode()) + "]";
+ }
}
1.2.10.1 +7 -3 JBossRemoting/src/main/org/jboss/remoting/InvocationResponse.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvocationResponse.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/InvocationResponse.java,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -u -b -r1.2 -r1.2.10.1
--- InvocationResponse.java 30 Dec 2005 05:26:38 -0000 1.2
+++ InvocationResponse.java 13 Jan 2007 12:42:34 -0000 1.2.10.1
@@ -22,7 +22,6 @@
package org.jboss.remoting;
-import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
@@ -33,7 +32,7 @@
* null in the case the user returns null)
*
* @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.2.10.1 $
*/
public class InvocationResponse implements Serializable
{
@@ -45,7 +44,6 @@
private Map payload;
public InvocationResponse(String sessionId, Object result, boolean isException, Map payload)
- throws IOException
{
this.sessionId = sessionId;
this.isException = isException;
@@ -72,4 +70,10 @@
{
return result;
}
+
+ public String toString()
+ {
+ return "InvocationResponse[" + Integer.toHexString(hashCode()) + "]";
+ }
+
}
1.7.2.2 +17 -29 JBossRemoting/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MicroRemoteClientInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -b -r1.7.2.1 -r1.7.2.2
--- MicroRemoteClientInvoker.java 10 Jan 2007 10:30:33 -0000 1.7.2.1
+++ MicroRemoteClientInvoker.java 13 Jan 2007 12:42:34 -0000 1.7.2.2
@@ -27,7 +27,7 @@
*
* @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
* @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
- * @version $Revision: 1.7.2.1 $
+ * @version $Revision: 1.7.2.2 $
*/
public abstract class MicroRemoteClientInvoker extends AbstractInvoker implements ClientInvoker
{
@@ -40,7 +40,7 @@
private String invokerSessionId = new GUID().toString();
private static final Logger log = Logger.getLogger(MicroRemoteClientInvoker.class);
- private static final boolean isTraceEnabled = log.isTraceEnabled();
+ private boolean trace = log.isTraceEnabled();
public MicroRemoteClientInvoker(InvokerLocator locator)
{
@@ -53,22 +53,14 @@
}
/**
- * transport a request against a remote ServerInvoker
- *
- * @param invocationReq
- * @return
- * @throws Throwable
+ * Transport a request against a remote ServerInvoker.
*/
- public Object invoke(InvocationRequest invocationReq)
- throws Throwable
+ public Object invoke(InvocationRequest invocationReq) throws Throwable
{
Object returnValue = null;
int invokeCount = 0;
- if (isTraceEnabled)
- {
- log.trace(this + "(" + (++invokeCount) + ") invoking =>" + invocationReq + " with parameter: " + invocationReq.getParameter());
- }
+ if (trace) { log.trace(this + "(" + (++invokeCount) + ") invoking " + invocationReq + " with parameter " + invocationReq.getParameter()); }
Marshaller marshaller = getMarshaller();
UnMarshaller unmarshaller = getUnMarshaller();
@@ -124,25 +116,18 @@
returnValue = transport(invocationReq.getSessionId(), payload, metadata, marshaller, unmarshaller);
- if (isTraceEnabled)
- {
- log.trace("received result=>" + returnValue);
- }
-
// Now check if is remoting response and process
if (returnValue instanceof InvocationResponse)
{
InvocationResponse response = (InvocationResponse) returnValue;
returnValue = response.getResult();
- if (isTraceEnabled)
- {
- log.trace("received result was an InvocationResponse so going to return response's return value of " + returnValue);
- log.trace("response is exception = " + response.isException());
- }
+
// if is a server side exception, throw it
if (response.isException())
{
- Throwable e = (Throwable) returnValue;
+ Throwable e = (Throwable)returnValue;
+
+ if (trace) { log.trace(this + " received a server-side exception as response to the invocation: " + e); }
StackTraceElement[] serverStackTrace;
if (e.getCause() != null)
@@ -186,6 +171,9 @@
throw e;
}
+
+ if (trace) { log.trace(this + " received InvocationResponse so going to return response's return value of " + returnValue);}
+
}
return returnValue;
@@ -288,7 +276,7 @@
*/
public synchronized void disconnect()
{
- if (isTraceEnabled) { log.trace(this + " disconnecting ..."); }
+ if (trace) { log.trace(this + " disconnecting ..."); }
if (connected)
{
@@ -299,11 +287,11 @@
{
((ClassByteClassLoader) classbyteloader).destroy();
}
- if (isTraceEnabled) { log.trace(this + " disconnected"); }
+ if (trace) { log.trace(this + " disconnected"); }
}
else
{
- if (isTraceEnabled) { log.trace(this + " is not connected!"); }
+ if (trace) { log.trace(this + " is not connected!"); }
}
}
@@ -357,7 +345,7 @@
{
try
{
- if(isTraceEnabled)
+ if(trace)
{
log.trace("Sending initial lease ping to server for client invoker (session id " + invokerSessionId + ") to determine " +
"if server has leasing enabled.");
@@ -383,7 +371,7 @@
}
}
- if(isTraceEnabled)
+ if(trace)
{
log.trace("Server does have leasing enabled (with default lease period of " + defaultLeasePeriod + ") and will start a new lease pinger.");
}
1.52.2.12 +19 -32 JBossRemoting/src/main/org/jboss/remoting/ServerInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ServerInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/ServerInvoker.java,v
retrieving revision 1.52.2.11
retrieving revision 1.52.2.12
diff -u -b -r1.52.2.11 -r1.52.2.12
--- ServerInvoker.java 11 Jan 2007 21:56:03 -0000 1.52.2.11
+++ ServerInvoker.java 13 Jan 2007 12:42:34 -0000 1.52.2.12
@@ -39,6 +39,7 @@
import org.jboss.util.threadpool.BlockingMode;
import org.jboss.util.threadpool.ThreadPool;
import org.jboss.util.threadpool.ThreadPoolMBean;
+import org.jboss.logging.Logger;
import javax.management.MBeanServer;
import javax.management.MBeanServerInvocationHandler;
@@ -59,10 +60,14 @@
*
* @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
* @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
- * @version $Revision: 1.52.2.11 $
+ * @version $Revision: 1.52.2.12 $
*/
public abstract class ServerInvoker extends AbstractInvoker implements ServerInvokerMBean
{
+ private static final Logger log = Logger.getLogger(ServerInvoker.class);
+
+ private static boolean trace = log.isTraceEnabled();
+
/**
* Key for the the maximum number of thread to be used in the thread pool
* for one way invocations (server side).
@@ -185,8 +190,6 @@
protected ServerSocketFactory serverSocketFactory = null;
- private boolean isTraceEnabled = false;
-
public ServerInvoker(InvokerLocator locator)
{
super(locator);
@@ -195,7 +198,6 @@
{
configuration.putAll(locator.getParameters());
}
- isTraceEnabled = log.isTraceEnabled();
}
public ServerInvoker(InvokerLocator locator, Map configuration)
@@ -210,7 +212,6 @@
{
this.configuration.putAll(locator.getParameters());
}
- isTraceEnabled = log.isTraceEnabled();
}
protected void setup() throws Exception
@@ -841,10 +842,7 @@
InvocationRequest request = null;
InvocationResponse response = null;
- if(isTraceEnabled)
- {
- log.trace("server received invocation =>" + invoke);
- }
+ if(trace) { log.trace("server received invocation " + invoke); }
if(invoke != null && invoke instanceof InvocationRequest)
{
@@ -860,10 +858,6 @@
}
catch(Throwable throwable)
{
- if(isTraceEnabled)
- {
- //throwable.printStackTrace();
- }
response = new InvocationResponse(request.getSessionId(),
throwable, true, request.getReturnPayload());
}
@@ -992,10 +986,7 @@
}
else
{
- if (isTraceEnabled)
- {
- log.trace("dispatching invocation: " + invocation + " to subsystem: " + subsystem + " from client: " + clientId);
- }
+ if (trace) { log.trace(this + " dispatching invocation " + invocation + " from client " + clientId + " to subsystem " + subsystem); }
if (handler == null)
{
@@ -1005,13 +996,9 @@
}
result = handler.invoke(invocation);
}
- if (isTraceEnabled)
- {
- log.trace("dispatch invocation, returning back: " + result + " from subsystem: " + subsystem +
- " to client: " + clientId);
- }
- }
+ if (trace) { log.trace(this + " successfully dispatched invocation, returning " + result + " from subsystem " + subsystem + " to client " + clientId); }
+ }
return result;
}
@@ -1068,7 +1055,7 @@
String clientSessionId = invocation.getSessionId();
if(clientSessionId != null)
{
- if(isTraceEnabled)
+ if(trace)
{
log.trace("Getting lease for client session id: " + clientSessionId);
}
@@ -1083,7 +1070,7 @@
clientLeases.put(clientSessionId, newClientLease);
newClientLease.startLease();
- if(isTraceEnabled)
+ if(trace)
{
log.trace("No lease established for client session id (" + clientSessionId + "), so starting a new one.");
}
@@ -1093,7 +1080,7 @@
// including request payload from invocation as may contain updated list of clients.
clientLease.updateLease(leasePeriod, invocation.getRequestPayload());
- if(isTraceEnabled)
+ if(trace)
{
log.trace("Updated lease for client session id (" + clientSessionId + ")");
}
@@ -1154,7 +1141,7 @@
{
Object result = null;
String methodName = param.getMethodName();
- if(isTraceEnabled)
+ if(trace)
{
log.trace("handling InternalInvocation where method name = " + methodName);
}
@@ -1183,7 +1170,7 @@
"or via the Connector's addInvocationHandler() method.");
}
handler.removeListener(callbackHandler);
- if(isTraceEnabled)
+ if(trace)
{
log.trace("ServerInvoker (" + this + ") removing server callback handler " + callbackHandler + ".");
}
@@ -1199,7 +1186,7 @@
else if(InternalInvocation.GETCALLBACKS.equals(methodName))
{
ServerInvokerCallbackHandler callbackHandler = getCallbackHandler(invocation);
- if(isTraceEnabled)
+ if(trace)
{
log.trace("ServerInvoker (" + this + ") getting callbacks for callback handler " + callbackHandler + ".");
}
@@ -1209,7 +1196,7 @@
else if(InternalInvocation.ACKNOWLEDGECALLBACK.equals(methodName))
{
ServerInvokerCallbackHandler callbackHandler = getCallbackHandler(invocation);
- if(isTraceEnabled)
+ if(trace)
{
log.trace("ServerInvoker (" + this + ") acknowledge callback on callback handler " + callbackHandler + ".");
}
@@ -1252,7 +1239,7 @@
else if(InternalInvocation.HANDLECALLBACK.equals(methodName))
{
String sessionId = ServerInvokerCallbackHandler.getId(invocation);
- if(isTraceEnabled)
+ if(trace)
{
log.trace("ServerInvoker (" + this + ") is being asked to deliver callback on client callback handler with session id of " + sessionId + ".");
}
@@ -1328,7 +1315,7 @@
callbackHandlers.put(id, callbackHandler);
}
}
- if(isTraceEnabled)
+ if(trace)
{
log.trace("ServerInvoker (" + this + ") adding server callback handler " + callbackHandler + " with id of " + id + ".");
}
More information about the jboss-cvs-commits
mailing list