This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Using Threads for Business Logic in servlets

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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic