Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

thread safety check

 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
removeItem removes items from an order which comes from the session. There may cause an ArrayIndexOutOfBounds at itemsToRemove.remove(a);
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic