Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Gin Tanaka   on Jun 27 In Java Category.

  
Question Answered By: Arthur Cole   on Jun 27

the quick answer is no and while item  T is in user  A's basket it is reserved already,

isolation within J2EE guarantees that the same data is immune from concurrent access of multiple users, so that users' access are isolated from one another but this is under your own control and you can define the correct isolation level to align with your system  efficiency, scalability and reliability

your problem looks like a dirty read happening while user B might access item T when user A has not committed its operation on item T yet. here you need to choose  a proper isolation level to make sure user B reads the committed data only. you might need to use locking on the shared data here or perform serialization of transactions for users. this might be a bit tricky as when you have parallel transactions, the improper isolation level will lead to disaster.

from usability point of view (which I guess is your main point for this question) IMHO, you might need to lock  the data (as you transactions are parallel) and user B might can be provided to reserve the purchase for item T and can be asked to come back later this is because your system still does not have a committed operation on item T.
so in simple terms, when user B wants to purchase T, and T is in basket of user A, system can tell B to check again later or reserve and purchase or get notified of availability  later, but definitely you should not allow both of them to purchase the single available item T.

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on online shopping system scenario/analysis Or get search suggestion and latest updates.