• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using Threads for Business Logic in servlets  RSS feed

Catalin Mihalache
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm studying for SCWCD. Today I read in the Sevlet2.4 Specs about Distributed Servlets Container. There is a very interesting section (SRV.7.7.2) about persisting and migrating session objects.

In my old applications I used threads for performing some business logic (Business Logic that requested a lot of time). The idea was that at every 1 minute, the browser performed a request to check if my thread finished the job. For synchronization, I used some objects ob the session .

According with me, this model will fail when is used in a distributed servlet container - just because the session object may be persisted and migrated to another JVM. Obviously, the thread and the session object (that contains the synchronization objects) are on different JVMs.

My question for you are:
a) is this correct (the model is wrong) ?
b) how to solve this situation ? (but without using an EJB container)

Thanks and excuse my poor english.
Catalin Mihalache
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!