do I need synchronized for java bean method?

Discussions

Web tier: servlets, JSP, Web frameworks: do I need synchronized for java bean method?

  1. do I need synchronized for java bean method? (3 messages)

    in today's web application, we use a lot of java beans at web tier like:
    private String abc;
    public String getAbc(){
     return abc;
    }
    public void setAbc(String a){
     abc = a;
    }

    realized there is multi thread safe issue in java servlet, do I need to put synchronized modifier for each method?
    I never seen any example do that. why?

    Threaded Messages (3)

  2. no,[ Go to top ]

    no, you don't do that
  3. no,[ Go to top ]

    Thank you for reply.
    could you please tell me the reason? it doesn't have thread issue?
  4. no this is so trouble[ Go to top ]

    you can synchronized for class or synchronized for some scriptlet in jsp