Skip to content

Use try-with-resources for Transactions #49

Closed
@jboynes

Description

It would be nice to be able to use the resource pattern around a Transaction:

try (Transaction tx = datastore.newTransaction()) {
  // do stuff
  tx.commit();
}

Default behaviour of close() would be to roll back a transaction. This is to avoid potential errors caused by the application failing to catch unexpected Throwables causing incomplete work to be auto-committed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

api: datastoreIssues related to the Datastore API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions