الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Is it Synchronized?

مغلق
بدأه Aladdin11 في 23 أبريل 2003 · 2 رد · 821 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

I want to use some method in a JSP page, this method takes an array as an input and gives an array as an output, I mean that this method could be invoced simultaneously many times but everytime with different data in input and output; sould this method be sinchronized?

Is it enough that it works on its own data everytime to have no conflicts?

#2

no, you don't need to make it "synchronized" , simply your method does NOT change a global variable, your method only takes something in and brings something out.

let's say you have two working threads at the same time, doing some mathmatical computation, they would probably use the methods Math.cos() , Math.sqrt() and so on , these two methods are NOT synchronized because they don't change global variables.

public static double sqrt(double a)
#3

Thank you very much indeed, I wish you take a look to another cmming question of my own , I would do appriciate it if you give me some answer to it.

هذا الموضوع مغلق.

مواضيع مشابهة