125126127128129130131132133134135
entity.setProperty(DEVICE_REG_ID_PROPERTY, newId); datastore.put(entity); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } } /**
148149150151152153154155156157158
devices.add(device); } txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } return devices; }
169170171172173174175176177178179
logger.fine("Total number of devices: " + total); txn.commit(); return total; } finally { if (txn.isActive()) { txn.rollback(); } } } private static Entity findDeviceByRegId(String regId) {
214215216217218219220221222223224
encodedKey = KeyFactory.keyToString(key); logger.fine("multicast key: " + encodedKey); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } return encodedKey; }
242243244245246247248249250251252
} catch (EntityNotFoundException e) { logger.severe("No entity for key " + key); return Collections.emptyList(); } finally { if (txn.isActive()) { txn.rollback(); } } } /**
270271272273274275276277278279280
entity.setProperty(MULTICAST_REG_IDS_PROPERTY, devices); datastore.put(entity); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } } /**
289290291292293294295296297298299
Key key = KeyFactory.stringToKey(encodedKey); datastore.delete(key); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } } }
173174175176177178179180181182183
} } transaction.commit(); } finally { if (transaction.isActive()) { transaction.rollback(); } } return true; }
383384385386387388389390391392393
try { keys = dataStore.put(tx, shardedValues); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } } return keys; } });
138139140141142143144145146147
} catch (Exception e) { return ResultType.ADD_FAIL; } finally { if (txn.isActive()) { _logger.info("Rolling back transaction"); txn.rollback(); } } } }