Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to implement Concurrent access to records..Please help me URGENTLY

 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a scenario as below
Please help me out to implement this ;-)

-------------------
Scenario
-------------------
1> 2 users are accessing a single record (in a web based J2EE App) at the same time
2> 1 user should be able to see one of the records in READ ONLY MODE and the other user in WRITE ONLY MODE

Assuming 1st user access's 1st Record hence RECORD1.WRITE_ONLY_MODE -- EDITABLE

Assuming 2nd user access's 1st Record hence should be RECORD1.READ_ONLY_MODE -- NON EDITABLE

3> When the 1st user is accessing the 1st record,He enters the details of the 1st record,and clicks on "save button",The data gets saved to the db.
;When the 2nd user access the 1st record at the same instance of time,he should be displayed with a message saying " RECORD IS LOCKED BY ANOTHER USER,Trying Accessing After Sometime"

5>The 1st user after saving the data for 1st record comes out of the record profile.now if the 2nd user tries to "REFRESH" The Jsp page and tries to access the same 1st RECORD ,He should be displayed with the message "RECORD IS AVAILABLE FOR CHANGES."


How do i go about in implementing this in a J2EE Web based application.

IN CASE IF U KNOW THE IMPLEMENTATION LOGIC.PLEASE PROVIDE THE SAME
 
Campbell Ritchie
Sheriff
Pie
Posts: 48932
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read the important administrative private message I am sending you in a minute or two.

Don't go round saying things are urgent.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Campbell,
Is my displayed name now correct??
Guys please help me around with this query....
 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What persistence framework are you using? Hibernate, JDBC, etc. Read up on the database isolation levels and ACID properties. If you are using Hibernate, you can use its optimistic locking strategy. Also have a look at "select for update ...."
[ September 20, 2008: Message edited by: arulk pillai ]
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi arulk pillai
Assume its a simple J2EE web based application built using jsp's and servlets,

How would you implement Concurrent access feature to records.??
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what this interview/assignment question is trying to get you to talk about is locking strategies. In which case arulk pillai has already mentioned one, and hinted at another. I'd have a google for them and see what you learn, or alternatively try searching this forum.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I'm unable to get any information ,Please help me.
Deepak lal
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by arulk pillai:
What persistence framework are you using? Hibernate, JDBC, etc. Read up on the database isolation levels and ACID properties. If you are using Hibernate, you can use its optimistic locking strategy. Also have a look at "select for update ...."

[ September 20, 2008: Message edited by: arulk pillai ]


Have a google for the highlighted terms.
[ September 22, 2008: Message edited by: Paul Sturrock ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic