[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...
Ron Sigal
ron_sigal at yahoo.com
Mon Sep 25 19:47:02 EDT 2006
User: rsigal
Date: 06/09/25 19:47:02
Modified: src/main/org/jboss/remoting Client.java
Log:
JBREM-605: Added acknowledgeCallback() method.
Revision Changes Path
1.50 +35 -1 JBossRemoting/src/main/org/jboss/remoting/Client.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Client.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/Client.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- Client.java 20 Sep 2006 04:22:26 -0000 1.49
+++ Client.java 25 Sep 2006 23:47:02 -0000 1.50
@@ -23,8 +23,10 @@
package org.jboss.remoting;
import org.jboss.logging.Logger;
+import org.jboss.remoting.callback.Callback;
import org.jboss.remoting.callback.CallbackPoller;
import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
import org.jboss.remoting.invocation.InternalInvocation;
import org.jboss.remoting.invocation.OnewayInvocation;
import org.jboss.remoting.marshal.Marshaller;
@@ -59,7 +61,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.49 $
+ * @version $Revision: 1.50 $
*/
public class Client implements Externalizable
{
@@ -1090,6 +1092,38 @@
}
}
+ public void acknowledgeCallback(InvokerCallbackHandler callbackHandler, Callback callback) throws Throwable
+ {
+ if (callbackHandler == null)
+ throw new Exception("InvokerCallbackHandler parameter must not be null");
+
+ if (callback == null)
+ throw new Exception("Callback parameter must not be null");
+
+ if (isConnected())
+ {
+ Map returnPayload = callback.getReturnPayload();
+ if (returnPayload != null)
+ {
+ Object callbackId = returnPayload.get(ServerInvokerCallbackHandler.CALLBACK_ID);
+ if (callbackId != null)
+ {
+ Map metadata = createListenerMetadata(callbackHandler);
+ InternalInvocation invocation = new InternalInvocation(InternalInvocation.ACKNOWLEDGECALLBACK, new Object[]{callbackId});
+ invoke(invocation, metadata);
+ }
+ else
+ {
+ throw new Exception("Will not acknowledge Callback because it has no registered Listener.");
+ }
+ }
+ }
+ else
+ {
+ throw new Exception("Can not acknowledge Callback due to not being connected to server.");
+ }
+ }
+
/**
* Sets the marshaller implementation that should be used by the
* client invoker (transport). This overrides the client's default
More information about the jboss-cvs-commits
mailing list