Hi folks,
Haven't been around these parts for a while, but hoping somebody can answer something I've been puzzling over these last few days.
I have a common
java object, just a POJO, that I'm calling from several
JSP's. This object builds a list of data that is returned to the JSP in the form of an ArrayList - the JSP iterates thru the ArrayList and formats the output.
The POJO class has code that looks something like this:
public class MyClass {
public ArrayList getMeSomeData(
String parm1, String parm2) {
// code that gets data and creates ArrayList.
return myArrayList;
}
}
In my JSP, I have the something like following in scriptlet code (NOT in declaration) :
MyClass mc = new MyClass();
List theResults = mc.getMeSomeData("xx", "xx");
Seeing as a) getMeSomeData is called from several JSP's, and b) could be called simultaneously by several users, what is the correct way to synchronize this call ?
Should I:
a) synchronize the getMeSomeData() declaration?
b) somehow synchronize within the JSP ?
c) some other method ?
d) synchronization is not necessary in this example ?
Any help greatly appreciated, many thanks in advance.