Announcement Announcement Module
No announcement yet.
HTTP invoker concurrency questions Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTP invoker concurrency questions

    I'm a new guy to the Spring, and now i plan to use the HTTPInvoker mechanism as a communication channel between two spring applications-Server and client, The Server may support multi-clients to get the exported service, I have no iead if the Same API/service export by Server can be called by multi-clients at the same time, and if have some issue like thread-safe.

    Anyone can help me about this?

    Thanks and Regards

  • #2
    If the same object is shared between threads, it needs to be threadsafe.

    Threadsafety in this case can be realized in different ways:
    - make your object immutable. In most cases service objects are immutable. All state is written to the database, and the database is responsible for isolating the transactions (with some help from the developer like setting the isolation level, select ... for update and optimistic locking).

    - add synchronization. In most cases this should be avoided because it is complex.

    The immutable approach in most cases is the best approach. So as long as your object is immutable, you don't need to worry about multithreading issues.