Announcement Announcement Module
Collapse
No announcement yet.
is Controller thread-safe or not? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • is Controller thread-safe or not?

    Hi all,

    This question seems stupid, i am just a little bit confused. I read some articles today says the Spring controllers are not thread-safe like Action in Struts, however, when i reviewed the Spring source code and Spring doc I found that "Any implementation of the Controller interface should be a reusable, thread-safe class", would anyone help me out of the confusion.

    thanks a million,
    thurm

  • #2
    well it depends on your implementation if the controller is threadsafe or not. All SpringBeans that are instantiated as Singeltons should be threadsafe - that means no usage of static member variables, no unsychronized write access to member variables. Read access to member variables need not be synchronized.

    All spring classes are threadsafe by default - excluding some internal classes that are only used by the container.

    cheers

    Kai

    Comment

    Working...
    X