Break-out subscribing to our place so that it can be overridden.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6772 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -308,22 +308,7 @@ public class LocationDirector extends BasicDirector
|
|||||||
_controller.init(_ctx, config);
|
_controller.init(_ctx, config);
|
||||||
|
|
||||||
// subscribe to our new place object to complete the move
|
// subscribe to our new place object to complete the move
|
||||||
_subber = new SafeSubscriber<PlaceObject>(_placeId, new Subscriber<PlaceObject>() {
|
subscribeToPlace();
|
||||||
public void objectAvailable (PlaceObject object) {
|
|
||||||
gotPlaceObject(object);
|
|
||||||
}
|
|
||||||
public void requestFailed (int oid, ObjectAccessException cause) {
|
|
||||||
// aiya! we were unable to fetch our new place object; something is badly wrong
|
|
||||||
log.warning("Aiya! Unable to fetch place object for new location", "plid", oid,
|
|
||||||
"reason", cause);
|
|
||||||
// clear out our half initialized place info
|
|
||||||
int placeId = _placeId;
|
|
||||||
_placeId = -1;
|
|
||||||
// let the kids know shit be fucked
|
|
||||||
handleFailure(placeId, "m.unable_to_fetch_place_object");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
_subber.subscribe(_ctx.getDObjectManager());
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warning("Failed to create place controller", "config", config, e);
|
log.warning("Failed to create place controller", "config", config, e);
|
||||||
@@ -450,6 +435,30 @@ public class LocationDirector extends BasicDirector
|
|||||||
_lservice = client.requireService(LocationService.class);
|
_lservice = client.requireService(LocationService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to the PlaceObject identified by _placeId and
|
||||||
|
* call {@link #gotPlaceObject} with the result.
|
||||||
|
*/
|
||||||
|
protected void subscribeToPlace ()
|
||||||
|
{
|
||||||
|
_subber = new SafeSubscriber<PlaceObject>(_placeId, new Subscriber<PlaceObject>() {
|
||||||
|
public void objectAvailable (PlaceObject object) {
|
||||||
|
gotPlaceObject(object);
|
||||||
|
}
|
||||||
|
public void requestFailed (int oid, ObjectAccessException cause) {
|
||||||
|
// aiya! we were unable to fetch our new place object; something is badly wrong
|
||||||
|
log.warning("Aiya! Unable to fetch place object for new location", "plid", oid,
|
||||||
|
"reason", cause);
|
||||||
|
// clear out our half initialized place info
|
||||||
|
int placeId = _placeId;
|
||||||
|
_placeId = -1;
|
||||||
|
// let the kids know shit be fucked
|
||||||
|
handleFailure(placeId, "m.unable_to_fetch_place_object");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_subber.subscribe(_ctx.getDObjectManager());
|
||||||
|
}
|
||||||
|
|
||||||
protected void gotPlaceObject (PlaceObject object)
|
protected void gotPlaceObject (PlaceObject object)
|
||||||
{
|
{
|
||||||
// yay, we have our new place object
|
// yay, we have our new place object
|
||||||
|
|||||||
Reference in New Issue
Block a user