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:
@@ -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;
|
package com.threerings.cocktail.cher.client;
|
||||||
|
|
||||||
@@ -63,16 +63,23 @@ public class InvocationManager
|
|||||||
* caller invoked a procedure named <code>Switch</code>, the response
|
* caller invoked a procedure named <code>Switch</code>, the response
|
||||||
* may be delivered via a call to the <code>handleSwitchSuccess</code>
|
* may be delivered via a call to the <code>handleSwitchSuccess</code>
|
||||||
* method on the response target object. The signature of that method
|
* 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 module the name of the invocation module to use.
|
||||||
* @param procedure the name of the procedure within that module.
|
* @param procedure the name of the procedure within that module.
|
||||||
* @param args the arguments of the invocation.
|
* @param args the arguments of the invocation.
|
||||||
* @param rsptarget the object that will receive the response, or null
|
* @param rsptarget the object that will receive the response, or null
|
||||||
* if no response is desired.
|
* 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)
|
Object rsptarget)
|
||||||
{
|
{
|
||||||
int invid = nextInvocationId();
|
int invid = nextInvocationId();
|
||||||
|
|
||||||
@@ -96,6 +103,8 @@ public class InvocationManager
|
|||||||
|
|
||||||
// and finally ship off the invocation message
|
// and finally ship off the invocation message
|
||||||
_omgr.postEvent(event);
|
_omgr.postEvent(event);
|
||||||
|
|
||||||
|
return invid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,9 +168,10 @@ public class InvocationManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prune the method arguments from the full message arguments
|
// prune the invocation id and method arguments from the full
|
||||||
Object[] rargs = new Object[args.length-2];
|
// message arguments
|
||||||
System.arraycopy(args, 2, rargs, 0, rargs.length);
|
Object[] rargs = new Object[args.length-1];
|
||||||
|
System.arraycopy(args, 1, rargs, 0, rargs.length);
|
||||||
|
|
||||||
// and invoke the response method
|
// and invoke the response method
|
||||||
String mname = "handle" + name;
|
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;
|
package com.threerings.cocktail.cher.client.test;
|
||||||
|
|
||||||
@@ -8,9 +8,9 @@ import com.threerings.cocktail.cher.client.InvocationReceiver;
|
|||||||
|
|
||||||
public class TestReceiver implements 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 +
|
Log.info("Received tell notification [invid=" + invid +
|
||||||
", two=" + two + "].");
|
", one=" + one + ", two=" + two + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user