When writing web applications in Java one thing which almost every Java programmer would have to do at some point or the other is to write servlets. What does one mean when they say you should write servlets that are "Threadsafe" ?
To answer this question, first one should understand what multithreading and the servlet life cycle model are. A servlet container manages the life cycle of a servlet, meaning the servlet's creation, execution and destruction. Among several things a servlet container helps you in building efficient web applications by managing the life cycle of a servlet. In general the way it does this is to maintain a single instance of the servlet in the memory. Each HTTP request that the servlet container receives results in a thread being spawned to this "One Single" instance of servlet. For examples 10 simultaneous HTTP requests will result in 10 thread of execution on the same instance of servlet in the memory.
One very important thing which often programmers miss out here is that one should almost never user instance variables in a servlet unless they are absolutely needed and you know exactly what you are going to do with them. The reason is that as mentioned above there is only one instance of servlet in the memory. Therefore all the threads (HTTP requests) will be sharing the same piece of memory allocated for the instance variables which are bound to the servlet class. As a result any write operations being done on these variables are being done on the same memory allocation. This may result in unexpected and often bizarre behavior in web applications.
Friday, May 02, 2008
Tuesday, February 26, 2008
My age is 29 and my body age is 31....
Got my body age analysis done.......my body age is 31....and my actual age is 29. My next test will be in another two months......really really looking forward to it...and bring down the age to 29.
I did very well on the cardio-vascular and flexibility tests. My bicep strength was very good too.....one thing which I need to improve on is the weight.......
One thing is for sure.....getting yourself into proper shape is not easy and requires lot of determination and patience. It is not going to happen overnight.....
I did very well on the cardio-vascular and flexibility tests. My bicep strength was very good too.....one thing which I need to improve on is the weight.......
One thing is for sure.....getting yourself into proper shape is not easy and requires lot of determination and patience. It is not going to happen overnight.....
Sidney Poitier
The first black male to win the Academy Award for Best Actor - for his role in Lilies of the Field, Sidney Poitier is one of the greatest actor in history of cinema.
To Sir, With Love,
In the Heat of the Night, and
Guess Who's Coming to Dinner
are some of his notable movies.
To Sir, With Love,
In the Heat of the Night, and
Guess Who's Coming to Dinner
are some of his notable movies.
Sunday, February 17, 2008
Skeeeeeeing at Cascade Mountains, WI
Cascade Mountains, WI is about 4 1/2 hours drive from my place. It was my first experience skiing and it was lot of fun. Had seen lot of funny and not so funny crashes.....After skiing, the fire place at the coffee shop was a good place to warm up yourself.
Go Cascade Mountains
Go Cascade Mountains
Wednesday, January 30, 2008
Thinking in Calories !!!
When one is working out and burning calories....it becomes very difficult not to "Think in Calories !!". It gets down to one potato chip is about 12-13 calories or one beer is about 160 calories.
If I eat 10 ships I would have to a run an extra mile.
If I drink 2 beers I would have to do a cross-training routine on the elliptical for an extra 30 minutes.
So....I would rather....not eat the 10 chips and not drink the two beers and continue with my usual workout routine.
If I eat 10 ships I would have to a run an extra mile.
If I drink 2 beers I would have to do a cross-training routine on the elliptical for an extra 30 minutes.
So....I would rather....not eat the 10 chips and not drink the two beers and continue with my usual workout routine.
Saturday, January 19, 2008
India Vs Australia 3rd Test
What a fitting reply. Just two weeks after enduring the pain of watching the Indians going down at Sydney, it has been an absolute joy watching the Indians win against Australia at Perth in the 3rd test bringing their winning streak to a screeching halt. Only one team was able to do this earlier in the entire cricket history and that was West Indies some time in the last century !!
Monday, January 07, 2008
Sunday, January 06, 2008
Indian team goes down figting in Down Under !! - Second Test
What can I say......Avid cricket fan that I am....I was watching day 5 of the second test match at S.C.G just like many other fans. It felt like Indians were playing against 13 players instead of 11. I would add Steve "The Idiot" Bucknor and Mark "The Stupid" Benson in the Australian team. The umpiring decisions were atrocious. Starting from the decisions in favor of Symonds and Ponting.....to the decisions that went against Dravid, the umpiring on the whole has just been silly....
Cricket is a funny game one dismissal can determine whether a team is gonna win or lose. Yesterday, Dravid's dismissal was the turning point. Agreed that mistakes do happen....but the decision which sent back Dravid to the dressing room was......hmmm...how can any one ever give a batsman out caught behind in the fashion Bucknor did. All I can say is that Bucknor and Symonds are having a ball....and a wonderful game together.....
Dravid was looking comfortable at the crease with Ganguly.....had he not been given out...it would have been a comfortable draw....I am not whining here......No one can win if you are playing against umpires as well.....Look at this guy Benson, when Ganguly was caught by Clarke there was ample doubt in my mind as well Ganguly's and several other cricket lovers whether the catch was taken cleanly or not. What does Benson do ? he checks with the fielding captain Ponting to find out if the catch was taken cleanly or not and then makes a decision to send back Ganguly to the pavilion. Umpires are on the field to take decisions on their own....and when in doubt they can refer to the third umpire not to the fielding captain as was this case. Had the decision been referred to the third umpire there was very fat chance that the benefit of doubt would have gone in favor of Ganguly.
Ponting a cricket hero in Australia is as unethical as it gets.....He takes a catch, a good edge in this case but the ball clearly the ball was grounded and he knew it pretty well as it was not just a contact but a thud into the ground.....but still the great Australian hero goes up appealing to the umpire.....Earlier in the match, this same Ricky stood rock solid at the crease even after it was so obvious to him that he had nicked a ball on the leg side,but when the whole Indian team went on appealing,he never made a move. .......replace Ponting with any other player from the sub continent the commentators would have gone berserk. In fact replace any of the players mentioned above with their counterparts from the opposite team....you would have seen hundreds of articles in the Australian media flaying the umpiring standards and how the sportsman spirit in Cricket is going down.........Cricket is no longer a gentleman's game....
I would like to add one thing though....the way Kumble played yesterday was simply outstanding. He was given a good hand by Dhoni and Bhajji......Kumble's batting yesterday was just sheer grit nothing more nothing less....every person has to take a cue from this guy....Kudos to him and the team....for fighting it out till the very end.....
Finally, I would have given the Man of the match to Steveeee instead of Roy....for his outstanding umpiring !!. Indian team management should now start thinking about the team composition. If I was made in charge :-) I will replace Jaffer and Yuvi with Sehwag and Irfan. Irfan will give us an extra bowling option and seeing the way Yuvi is playing......Irfan looks like a better option as far as the batting goes.....Jaffer is not able to cope up with the pace of Australian bowlers, Sehwag could be potent opener along with Dravid.
Cricket is a funny game one dismissal can determine whether a team is gonna win or lose. Yesterday, Dravid's dismissal was the turning point. Agreed that mistakes do happen....but the decision which sent back Dravid to the dressing room was......hmmm...how can any one ever give a batsman out caught behind in the fashion Bucknor did. All I can say is that Bucknor and Symonds are having a ball....and a wonderful game together.....
Dravid was looking comfortable at the crease with Ganguly.....had he not been given out...it would have been a comfortable draw....I am not whining here......No one can win if you are playing against umpires as well.....Look at this guy Benson, when Ganguly was caught by Clarke there was ample doubt in my mind as well Ganguly's and several other cricket lovers whether the catch was taken cleanly or not. What does Benson do ? he checks with the fielding captain Ponting to find out if the catch was taken cleanly or not and then makes a decision to send back Ganguly to the pavilion. Umpires are on the field to take decisions on their own....and when in doubt they can refer to the third umpire not to the fielding captain as was this case. Had the decision been referred to the third umpire there was very fat chance that the benefit of doubt would have gone in favor of Ganguly.
Ponting a cricket hero in Australia is as unethical as it gets.....He takes a catch, a good edge in this case but the ball clearly the ball was grounded and he knew it pretty well as it was not just a contact but a thud into the ground.....but still the great Australian hero goes up appealing to the umpire.....Earlier in the match, this same Ricky stood rock solid at the crease even after it was so obvious to him that he had nicked a ball on the leg side,but when the whole Indian team went on appealing,he never made a move. .......replace Ponting with any other player from the sub continent the commentators would have gone berserk. In fact replace any of the players mentioned above with their counterparts from the opposite team....you would have seen hundreds of articles in the Australian media flaying the umpiring standards and how the sportsman spirit in Cricket is going down.........Cricket is no longer a gentleman's game....
I would like to add one thing though....the way Kumble played yesterday was simply outstanding. He was given a good hand by Dhoni and Bhajji......Kumble's batting yesterday was just sheer grit nothing more nothing less....every person has to take a cue from this guy....Kudos to him and the team....for fighting it out till the very end.....
Finally, I would have given the Man of the match to Steveeee instead of Roy....for his outstanding umpiring !!. Indian team management should now start thinking about the team composition. If I was made in charge :-) I will replace Jaffer and Yuvi with Sehwag and Irfan. Irfan will give us an extra bowling option and seeing the way Yuvi is playing......Irfan looks like a better option as far as the batting goes.....Jaffer is not able to cope up with the pace of Australian bowlers, Sehwag could be potent opener along with Dravid.
Subscribe to:
Posts (Atom)