Start transactions outside of the try-finally clause so that if there

is a problem with starting a transaction, we don't get an exception
for failing to commit the transaction.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2712 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2003-07-16 18:03:30 +00:00
parent 2726f6a29d
commit 829f3ad0eb
4 changed files with 30 additions and 24 deletions
@@ -1,5 +1,5 @@
//
// $Id: LocationProvider.java,v 1.19 2003/02/26 17:54:56 mdb Exp $
// $Id: LocationProvider.java,v 1.20 2003/07/16 18:03:30 ray Exp $
package com.threerings.crowd.server;
@@ -155,8 +155,8 @@ public class LocationProvider
PlaceObject pold = (PlaceObject)_omgr.getObject(oldloc);
if (pold != null) {
Integer key = new Integer(bodoid);
pold.startTransaction();
try {
pold.startTransaction();
// remove their occupant info (which is keyed on oid)
pold.removeFromOccupantInfo(key);
// and remove them from the occupant list
@@ -1,5 +1,5 @@
//
// $Id: GameManager.java,v 1.66 2003/06/29 23:11:23 mdb Exp $
// $Id: GameManager.java,v 1.67 2003/07/16 18:03:30 ray Exp $
package com.threerings.parlor.game;
@@ -659,8 +659,8 @@ public class GameManager extends PlaceManager
return;
}
_gameobj.startTransaction();
try {
_gameobj.startTransaction();
// let the derived class do its pre-end stuff
gameWillEnd();
@@ -1,5 +1,5 @@
//
// $Id: InvocationDirector.java,v 1.28 2003/07/12 22:34:03 mdb Exp $
// $Id: InvocationDirector.java,v 1.29 2003/07/16 18:03:30 ray Exp $
package com.threerings.presents.client;
@@ -335,8 +335,8 @@ public class InvocationDirector
_clobj.addListener(InvocationDirector.this);
// reregister our receivers
_clobj.startTransaction();
try {
_clobj.startTransaction();
Iterator iter = receivers.entries();
while (iter.hasNext()) {
_clobj.addToReceivers((Registration)iter.next());
@@ -1,5 +1,5 @@
//
// $Id: SpotSceneManager.java,v 1.41 2003/06/03 21:41:33 ray Exp $
// $Id: SpotSceneManager.java,v 1.42 2003/07/16 18:03:30 ray Exp $
package com.threerings.whirled.spot.server;
@@ -423,20 +423,23 @@ public class SpotSceneManager extends SceneManager
removeFromCluster(body.getOid());
put(body.getOid(), body);
_ssobj.startTransaction();
try {
body.startTransaction();
_ssobj.startTransaction();
bodyAdded(this, body); // do the hokey pokey
try {
bodyAdded(this, body); // do the hokey pokey
if (_clobj != null) {
((ClusteredBodyObject)body).setClusterOid(
_clobj.getOid());
_clobj.addToOccupants(body.getOid());
_ssobj.updateClusters(_cluster);
if (_clobj != null) {
((ClusteredBodyObject)body).setClusterOid(
_clobj.getOid());
_clobj.addToOccupants(body.getOid());
_ssobj.updateClusters(_cluster);
}
} finally {
body.commitTransaction();
}
} finally {
body.commitTransaction();
_ssobj.commitTransaction();
}
@@ -454,19 +457,22 @@ public class SpotSceneManager extends SceneManager
return;
}
body.startTransaction();
try {
body.startTransaction();
_ssobj.startTransaction();
((ClusteredBodyObject)body).setClusterOid(-1);
bodyRemoved(this, body); // do the hokey pokey
try {
((ClusteredBodyObject)body).setClusterOid(-1);
bodyRemoved(this, body); // do the hokey pokey
if (_clobj != null) {
_clobj.removeFromOccupants(bodyOid);
_ssobj.updateClusters(_cluster);
if (_clobj != null) {
_clobj.removeFromOccupants(bodyOid);
_ssobj.updateClusters(_cluster);
}
} finally {
_ssobj.commitTransaction();
}
} finally {
_ssobj.commitTransaction();
body.commitTransaction();
}