Modified invocation services such that providers are responsible for
delivering their own responses. They now have all the information necessary to do so which means that they can delay the delivery of a response until some other asynchronous event has taken place (like a database load completing). Prior to this, they were required to complete their service immediately and return the response back to the invocation manager. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@216 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ChatProvider.java,v 1.2 2001/08/04 02:54:28 mdb Exp $
|
||||
// $Id: ChatProvider.java,v 1.3 2001/08/11 00:05:58 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.chat;
|
||||
|
||||
@@ -13,13 +13,13 @@ public class ChatProvider extends InvocationProvider
|
||||
* Processes a request from a client to deliver a tell message to
|
||||
* another client.
|
||||
*/
|
||||
public Object[] handleTellRequest (
|
||||
BodyObject source, String target, String message)
|
||||
public void handleTellRequest (
|
||||
BodyObject source, int invid, String target, String message)
|
||||
{
|
||||
// look up the target body object
|
||||
BodyObject tobj = PartyServer.lookupBody(target);
|
||||
if (tobj == null) {
|
||||
return createResponse("TellFailed", "m.player_not_online");
|
||||
sendResponse(source, invid, "TellFailed", "m.player_not_online");
|
||||
}
|
||||
|
||||
// deliver a tell notification to the target player
|
||||
@@ -28,6 +28,6 @@ public class ChatProvider extends InvocationProvider
|
||||
tobj.getOid(), ChatService.MODULE, ChatService.TELL_NOTIFICATION,
|
||||
args);
|
||||
|
||||
return createResponse("TellSucceeded");
|
||||
sendResponse(source, invid, "TellSucceeded");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LocationProvider.java,v 1.2 2001/08/04 01:13:36 mdb Exp $
|
||||
// $Id: LocationProvider.java,v 1.3 2001/08/11 00:05:58 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.server;
|
||||
|
||||
@@ -18,14 +18,16 @@ public class LocationProvider extends InvocationProvider
|
||||
/**
|
||||
* Processes a request from a client to move to a new place.
|
||||
*/
|
||||
public Object[] handleMoveToRequest (BodyObject source, int placeId)
|
||||
public void handleMoveToRequest (BodyObject source, int invid,
|
||||
int placeId)
|
||||
{
|
||||
// make sure the place in question actually exists
|
||||
DObject pobj = CherServer.omgr.getObject(placeId);
|
||||
if (pobj == null || !(pobj instanceof PlaceObject)) {
|
||||
Log.info("Requested to move to non-existent place " +
|
||||
"[source=" + source + ", place=" + placeId + "].");
|
||||
return createResponse("MoveFailed", "m.no_such_place");
|
||||
sendResponse(source, invid, "MoveFailed", "m.no_such_place");
|
||||
return;
|
||||
}
|
||||
|
||||
// acquire a lock on the body object to ensure that rapid fire
|
||||
@@ -33,7 +35,8 @@ public class LocationProvider extends InvocationProvider
|
||||
if (!source.acquireLock("moveToLock")) {
|
||||
// if we're still locked, a previous moveTo request hasn't
|
||||
// been fully processed
|
||||
return createResponse("MoveFailed", "m.move_in_progress");
|
||||
sendResponse(source, invid, "MoveFailed", "m.move_in_progress");
|
||||
return;
|
||||
}
|
||||
|
||||
// find out if they were previously in some other location
|
||||
@@ -63,6 +66,7 @@ public class LocationProvider extends InvocationProvider
|
||||
// once all these events are processed
|
||||
source.releaseLock("moveToLock");
|
||||
|
||||
return createResponse("MoveSucceeded");
|
||||
// send the response
|
||||
sendResponse(source, invid, "MoveSucceeded");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user