Modified the client side of the invocation services to communicate the

invocation request id to the invocation requester and then also to pass it
along when delivering the invocation response.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@180 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-04 02:54:01 +00:00
parent 7f82de4146
commit db9f2283f3
2 changed files with 21 additions and 11 deletions
@@ -1,5 +1,5 @@
//
// $Id: InvocationDirector.java,v 1.5 2001/08/03 02:12:12 mdb Exp $
// $Id: InvocationDirector.java,v 1.6 2001/08/04 02:54:01 mdb Exp $
package com.threerings.cocktail.cher.client;
@@ -63,15 +63,22 @@ public class InvocationManager
* caller invoked a procedure named <code>Switch</code>, the response
* may be delivered via a call to the <code>handleSwitchSuccess</code>
* method on the response target object. The signature of that method
* would be defined by the arguments provided in the response message.
* would be defined by the arguments provided in the response message
* with the addition of a first argument which is the invocation
* identifier for this particular request (that is also returned by
* this function).
*
* @param module the name of the invocation module to use.
* @param procedure the name of the procedure within that module.
* @param args the arguments of the invocation.
* @param rsptarget the object that will receive the response, or null
* if no response is desired.
*
* @return a unique identifier associated with this invocation
* request. This identifier will be passed as the first argument to
* the response function.
*/
public void invoke (String module, String procedure, Object[] args,
public int invoke (String module, String procedure, Object[] args,
Object rsptarget)
{
int invid = nextInvocationId();
@@ -96,6 +103,8 @@ public class InvocationManager
// and finally ship off the invocation message
_omgr.postEvent(event);
return invid;
}
/**
@@ -159,9 +168,10 @@ public class InvocationManager
return;
}
// prune the method arguments from the full message arguments
Object[] rargs = new Object[args.length-2];
System.arraycopy(args, 2, rargs, 0, rargs.length);
// prune the invocation id and method arguments from the full
// message arguments
Object[] rargs = new Object[args.length-1];
System.arraycopy(args, 1, rargs, 0, rargs.length);
// and invoke the response method
String mname = "handle" + name;
@@ -1,5 +1,5 @@
//
// $Id: TestReceiver.java,v 1.2 2001/08/04 02:31:20 mdb Exp $
// $Id: TestReceiver.java,v 1.3 2001/08/04 02:54:01 mdb Exp $
package com.threerings.cocktail.cher.client.test;
@@ -8,9 +8,9 @@ import com.threerings.cocktail.cher.client.InvocationReceiver;
public class TestReceiver implements InvocationReceiver
{
public void handleTestNotification (int one, String two)
public void handleTestNotification (int invid, int one, String two)
{
Log.info("Received tell notification [one=" + one +
", two=" + two + "].");
Log.info("Received tell notification [invid=" + invid +
", one=" + one + ", two=" + two + "].");
}
}