ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Best Practices for Exception Handling
Subject:   "Alternatively, you can even provide a method that checks if the username is already taken." not working
Date:   2003-12-03 14:07:00
From:   anonymous2
Response to: "Alternatively, you can even provide a method that checks if the username is already taken." not working

I think the author implicitly assumes you would write thread-safe code. Whether or not a method would be made of checking if the username exists, instead of throwing an exception, it still has to be checked.


By writing a thread-safe register method that would synchronize the checking for the username and the registering in one block, it should work.