Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7071847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:44:13+00:00 2026-05-28T05:44:13+00:00

I am trying to understand what happens during race conditions on the Google AppEngine

  • 0

I am trying to understand what happens during race conditions on the Google AppEngine datastore. I have been using Objectify, so I’ll use that notation here.

@Cached
public class Car {
  @Id
  public Long id;
  @Unindexed
  public String owner = "C";
}

Now consider I have two runnables that try to modify the owner of a particular car simultaneously.

Car myCar = ofy.get(Car.class, 10);
myCar.owner = "A";  // Other runnable uses "B"
ofy.put(myCar);
System.out.println(ofy.get(Car.class, 10).owner);

I presume in this case its undetermined whether Car(10) will be “owned” by “A” or “B” but no errors will be reported. It would not be clear to the “loser” until the writes were persisted into the datastore. What would the result of the printlns be?

If I had used transactions, would one of the runnables (the “loser”) have raised an exception?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:44:14+00:00Added an answer on May 28, 2026 at 5:44 am
    1. Both entities use the same ID (10) so one put() will overwrite the other. It’s only the question which does it first.

    2. The second transaction to put() would get the exception.

    Edit:

    You might get different exceptions during transaction, not all of them mean that change was not (or will not be) commited. You should actually inspect the transaction and rollback if appropriate. See first example: http://code.google.com/appengine/docs/java/datastore/transactions.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make sure that I understand what happens when I add
I'm trying to understand what's happening here: I have a supervisor that is cyclically
I have been trying to understand the exact meaning/purpose of loading php as an
I am trying understand ViewModels deeper and I have read many articles and blogs
Background I'm trying to understand matrix transformations. (Developing plugins for SketchUp using it's Ruby
I’m trying to understand what happens when a button is clicked in android. So
I am trying to understand what happens to a mutex when it is used
i am trying to understand why this won't run. I am thinking that I
I've been trying to understand why the following code gives me a bad pointer
I am trying to understand what things happen in the background when using a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.