This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!

Baruch Sadogursky

Ranch Hand
+ Follow
since Apr 09, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Baruch Sadogursky

Sun also see Constansts Interface as an antipattern. This is the primary reason for the "static import" feature, which is now applied in J2SE 1.5.
What I ment by utilty class is a helper class with static methods, and maybe some a REALY global constansts either. As much as I know it is a well sread practice with nothing wrong with it.
Constants interface considered a design antipattern. Don't use it. Just arrange the constants in classes they belong to. Another possibilty is to create utility class. It may consist only variables for start, but you may wish to add some helper methods in it later.
If the user can't find the record, it can be of varios reasons - record not found between other records, record marked as deleted, or record can not be read. Those are different causes of the same problem. I wrapped the IOException in RecordNotFoundException. It makes sense to me.
The option of passing the locking responsibility to the client brings a lot of complexivity to the application. Once you follow that strategy, you should track inactive/disconnected clients, in other words, make your server stateful.
On the other hand, by using a proxy or a facade you make the locked operations atomic, which release you from the need of mantainig conversation state with the client, makes your life easier, the application simplier, and once you'll want to change the locking strategy, you can switch the facade, or get rid of it totally.
One question - why to notify after adding cookie to the HashTable? How adding the lock to the table can change the waiting condition of the waiting threads? Correct me if I am wrong, but the only place in which the waiting condition can change is in the unlock() method - so it's the place to notify.
I have a big problem with the update() method, which doesn't throw the damn exception... Invent some RuntimeException while DuplicateKeyException exists seems somewhere ugly to me. I ignore it for meanwhile, but have opened a Thread in mind...
Baruch Sadogursky
No. 32

Originally posted by Satish Avadhanam:
On the client side, I catch RuntimeException to indicate the server has been shutdown and application has to be terminated.

Catching RuntimeException doesn't seem quite right for me in any circumstances.
The really interesting thing happen, when using UTF-8 encoding. In UTF-8 the chars can be both one or two bytes, so multiply by 2 won't work.
What do you mean by "won't be able to show it"? Sun will sue you if you'll show the code you wrote to someone? Come on, you taking the whole thing way too far. My SCJD project is my, pretty worthless (as a product) code! Once I will pass - I'll do with it whatever I want, if I'll find what to do with it.
Satish, if you don't mind about the copyright issues, send me your assignment, I want to check, that you really don't have more serious issues to take care of
Wow, guys, you are seriously concerned about the copyright issue, as I see
It seems so meaningless to me
What do you afraid of? That Sun will steal your priceless code? I doubt they need it. And if they will, how you will know? And if you will found out, what you gonna do? Sue them? You, small and lonely SCJD (I bet you'll pass), against the mighty law machine? The one, which kicked BG's ass? Come on, don't you have more serious issues to solve in the assignment?
P.S. The post above is totally copylefted by me
P.S.S. It doesn't intend to insult. I am respectful for everybody´┐Żs work, I just don't think the magic word will make it more protected. Sorry if I made someone angry
Short one, I hope the bartenders will close it after a couple of posts. There are enough endless academic discussions around
I saw some people that implement a queue to write to the file in a separate thread. My question is - doesn't the lock pool of the static synchronized RAF serve as such a queue?
Talking about Command design pattern, why not to use javax.swing.Action class??? It was invented to solve your question, and it implements the Command pattern exactly!
[ April 15, 2004: Message edited by: Baruch Sadogursky ]