aspose file tools*
The moose likes Servlets and the fly likes thread safety check Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "thread safety check" Watch "thread safety check" New topic
Author

thread safety check

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
I have been trying to implement some practices and good framework for maintaining future code in my servlets, that i have been using in core java.
I feel that i have done everything right to keep the servlet thread safe. Just looking for a second opinion. Always parinoid about locking threads.

Thanks
John


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

removeItem removes items from an order which comes from the session. There may cause an ArrayIndexOutOfBounds at itemsToRemove.remove(a);


[My Blog]
All roads lead to JavaRanch
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Christophe Verré wrote:removeItem removes items from an order which comes from the session. There may cause an ArrayIndexOutOfBounds at itemsToRemove.remove(a);


More of a null pointer i would assume
if EditOrderItems lineItem = itemsToRemove.get(a) has a valid value, itemsToRemove.remove(a); should not thow an out of bounds exception if im not mistaken.
Does the thread safety look ok?

thanks
john

EDIT: I see now what you were talking about: itemsToRemove = order.getEditItems();
Good catch. I will take cae of that too.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: thread safety check