• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is a thread safe class?  RSS feed

 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In one of my interview, intervieewer asked What is a thread safe class?
I didn't get its meaning?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www-128.ibm.com/developerworks/java/library/j-jtp09263.html
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the article cited above says, there is no exact definition of a thread-safe class.

In general, a class should document how best to use it in a multi-threaded application. If such documentation is lacking in a class that you've picked up from elsewhere, UTSL. If you don't have the source, you're in trouble.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, what a great hacker dictionery! Who knew that Yu-Shiang Whole Fish was hacker argot?

Here's another one -- now you know

one-banana problem
n. At mainframe shops, where the computers have operators for routine administrivia, the programmers and hardware people tend to look down on the operators and claim that a trained monkey could do their job. It is frequently observed that the incentives which would be offered said monkeys can be used as a scale to describe the difficulty of a task. A one-banana problem is simple; hence "It's only a one-banana job at the most; what's taking them so long?"

At IBM, folklore divides the world into one-, two-, and three-banana problems. Other cultures have different hierarchies and may divide them more finely; at ICL, for example, five grapes (a bunch) equals a banana. Their upper limit for the in-house sysapes is said to be two bananas and three grapes (another source claims it's three bananas and one grape, but observes "However, this is subject to local variations, cosmic rays and ISO"). At a complication level any higher than that, one asks the manufacturers to send someone around to check things.
[ January 04, 2006: Message edited by: Jeff Albrechtsen ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!