[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/callback ...
Ovidiu Feodorov
ovidiu.feodorov at jboss.com
Sat Jan 20 03:48:59 EST 2007
User: ovidiu
Date: 07/01/20 03:48:59
Modified: src/main/org/jboss/remoting/callback Tag: remoting_2_x
ServerInvokerCallbackHandler.java
Log:
Added more TRACE logging.
Revision Changes Path
No revision
No revision
1.15.2.7 +32 -52 JBossRemoting/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ServerInvokerCallbackHandler.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java,v
retrieving revision 1.15.2.6
retrieving revision 1.15.2.7
diff -u -b -r1.15.2.6 -r1.15.2.7
--- ServerInvokerCallbackHandler.java 5 Jan 2007 16:01:09 -0000 1.15.2.6
+++ ServerInvokerCallbackHandler.java 20 Jan 2007 08:48:59 -0000 1.15.2.7
@@ -61,6 +61,11 @@
*/
public class ServerInvokerCallbackHandler implements AsynchInvokerCallbackHandler
{
+
+ private static final Logger log = Logger.getLogger(ServerInvokerCallbackHandler.class);
+
+ private static boolean trace = log.isTraceEnabled();
+
private InvocationRequest invocation;
private Client callBackClient;
private ArrayList callbacks = new ArrayList();
@@ -121,8 +126,6 @@
*/
private Map idToListenerMap = Collections.synchronizedMap(new HashMap());
- private static final Logger log = Logger.getLogger(ServerInvokerCallbackHandler.class);
-
public ServerInvokerCallbackHandler(InvocationRequest invocation, InvokerLocator serverLocator, ServerInvoker owner) throws Exception
{
@@ -305,10 +308,8 @@
catch(Exception ex)
{
log.debug("Could not create callback store from the configration value given (" + storeName + ") as an MBean.");
- if(log.isTraceEnabled())
- {
- log.trace("Error is: " + ex.getMessage(), ex);
- }
+ if(trace) { log.trace("Error is: " + ex.getMessage(), ex); }
+
callbackStore = null;
}
@@ -323,10 +324,7 @@
catch(Exception e)
{
log.debug("Could not create callback store from the configuration value given (" + storeName + ") as a fully qualified class name.");
- if(log.isTraceEnabled())
- {
- log.trace("Error is: " + e.getMessage(), e);
- }
+ if(trace) { log.trace("Error is: " + e.getMessage(), e); }
}
}
}
@@ -391,10 +389,7 @@
{
log.debug("Could not create callback error handler from the configration value " +
"given (" + errorHandlerName + ") as an MBean.");
- if(log.isTraceEnabled())
- {
- log.trace("Error is: " + ex.getMessage(), ex);
- }
+ if(trace) { log.trace("Error is: " + ex.getMessage(), ex); }
callbackErrorHandler = null;
}
@@ -410,10 +405,7 @@
{
log.debug("Could not create callback error handler from the configuration value " +
"given (" + errorHandlerName + ") as a fully qualified class name.");
- if(log.isTraceEnabled())
- {
- log.trace("Error is: " + e.getMessage(), e);
- }
+ if(trace) { log.trace("Error is: " + e.getMessage(), e); }
}
}
}
@@ -462,12 +454,9 @@
/**
- * Returns an id that can be used to identify this particular
- * callback handler, which should be representative of the
- * client invoker it will make callbacks to. Currently, this
- * is the session id associated with the invocation request.
- *
- * @return
+ * Returns an id that can be used to identify this particular callback handler, which should be
+ * representative of the client invoker it will make callbacks to. Currently, this is the
+ * session id associated with the invocation request.
*/
public static String getId(InvocationRequest invocation)
{
@@ -485,11 +474,8 @@
}
/**
- * Returns an id that can be used to identify this particular
- * callback handler, which should be representative of the
- * client invoker it will make callbacks to.
- *
- * @return
+ * Returns an id that can be used to identify this particular callback handler, which should be
+ * representative of the client invoker it will make callbacks to.
*/
public String getId()
{
@@ -558,8 +544,7 @@
* @param callback
* @throws HandleCallbackException
*/
- public void handleCallback(Callback callback)
- throws HandleCallbackException
+ public void handleCallback(Callback callback) throws HandleCallbackException
{
handleCallback(callback, false, false);
}
@@ -573,8 +558,7 @@
* @param callback
* @throws HandleCallbackException
*/
- public void handleCallbackOneway(Callback callback)
- throws HandleCallbackException
+ public void handleCallbackOneway(Callback callback) throws HandleCallbackException
{
handleCallback(callback, true, false);
}
@@ -652,10 +636,7 @@
{
synchronized(callbacks)
{
- if(log.isTraceEnabled())
- {
- log.debug("pull callback. adding to callback list");
- }
+ if(trace){ log.debug(this + " got PULL callback. Adding to callback list ..."); }
callbacks.add(callback);
}
}
@@ -664,15 +645,14 @@
{
try
{
- if(log.isTraceEnabled())
- {
- log.debug("push callback. Calling client now.");
- }
+ if(trace){ log.debug(this + " got PUSH callback " + callback); }
boolean handleAcknowledgement = false;
+
if(callback != null)
{
Map returnPayload = callback.getReturnPayload();
+
if(returnPayload == null)
{
returnPayload = new HashMap();
@@ -692,20 +672,25 @@
callback.setReturnPayload(returnPayload);
}
- // sending internal invocation so server invoker we are sending to
- // will know how pass onto it's client callback handler
- InternalInvocation internalInvocation = new InternalInvocation(InternalInvocation.HANDLECALLBACK,
- new Object[]{callback});
+ // Sending internal invocation so server invoker we are sending to will know how
+ // pass onto it's client callback handler
+
+ InternalInvocation internalInvocation =
+ new InternalInvocation(InternalInvocation.HANDLECALLBACK, new Object[]{callback});
+
callBackClient.setSessionId(sessionId);
if (asynch)
{
+ if(trace){ log.debug(this + " sending ASYNCHRONOUSLY the callback to the client"); }
callBackClient.invokeOneway(internalInvocation, callback.getRequestPayload(), serverSide);
}
else
{
+ if(trace){ log.debug(this + " sending SYNCHRONOUSLY the callback to the client"); }
callBackClient.invoke(internalInvocation, callback.getRequestPayload());
}
+
handlePushCallbackAcknowledgement(callbackId, handleAcknowledgement);
}
catch(Throwable ex)
@@ -866,14 +851,9 @@
}
}
- /**
- * Returns the id for this handler
- *
- * @return
- */
public String toString()
{
- return getClass().getName() + " - id: " + getId();
+ return "ServerInvokerCallbackHandler[" + getId() + "]";
}
/**
More information about the jboss-cvs-commits
mailing list