Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lock() Client side or Back end?

 
Song Jing Lim
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need implement below methods...

But I don' tknow those methods will be internal use by Data.java or will call from front end UI?

If use by front end (UI) that means once user select a account to modify, system will check either record had lock for by other user and return modify not allow?

Any guide on that?

// Locks a record so that it can only be updated or deleted by this client.
// If the specified record is already locked, the current thread gives up
// the CPU and consumes no CPU cycles until the record is unlocked.
public void lock(int recNo) throws RecordNotFoundException;
// Releases the lock on a record.
public void unlock(int recNo) throws RecordNotFoundException;
// Determines if a record is currenly locked. Returns true if the
// record is locked, false otherwise.
public boolean isLocked(int recNo)
throws RecordNotFoundException;
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Song

There is no silver built here, you must decide for your self.
Take a look on :
http://www.coderanch.com/t/184224/java-developer-SCJD/certification/Should-lock-methods-callable-client

Regards M
 
Joe Zhou
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way is to do the locking at the backend.
There are hundreds post on this topic on this forum. You may search
them by key word 'locking'
 
Song Jing Lim
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks....

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic