diff --git a/src/java/com/threerings/presents/client/InvocationDirector.java b/src/java/com/threerings/presents/client/InvocationDirector.java index b81f2a324..f427709a3 100644 --- a/src/java/com/threerings/presents/client/InvocationDirector.java +++ b/src/java/com/threerings/presents/client/InvocationDirector.java @@ -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,16 +63,23 @@ public class InvocationManager * caller invoked a procedure named Switch, the response * may be delivered via a call to the handleSwitchSuccess * 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, - Object rsptarget) + 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; diff --git a/tests/src/java/com/threerings/presents/client/TestReceiver.java b/tests/src/java/com/threerings/presents/client/TestReceiver.java index 86fa94f18..a01d9cc43 100644 --- a/tests/src/java/com/threerings/presents/client/TestReceiver.java +++ b/tests/src/java/com/threerings/presents/client/TestReceiver.java @@ -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 + "]."); } }