This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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 ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

what the design pattern to be choosed  RSS feed

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
i have this problem:
i have an J2EE web application that should has to update every 24 hours take a global variable and be shared to all the j2ee web application.
would anyone tell me how to choose design(and dont tell me the singelton is useful)and implement design to proove if it work or not.
 
Ranch Hand
Posts: 137
Hibernate Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ibrahim,

According to the scenario you have posted, i think an Observer/Observable pattern would be feasible.This is just my suggestion , may be am wrong.
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any additional requirements? such as caching.

remeber the KISS principle.

Where are you going to store the data(observable)? simple answers DBMS, LDAP/JNDI, flat file on the client, as a static variable in a singleton class within the application. Note: I would argure the static variable is the least preferred way due to multi threading issues associated with static variables.

How are you going to determine if the data is updated? (observer) You can let the servlet/JSP just not cache the data, it will make a call to either a DAO or EJB/hibernate object to get the data. Cached reaponses to a singleton type. On the top of my head the name "service to worker" pops out. I am probably wrong in that name, I have not had my morning coffee.

How are you going to tell the system to update the data? That depends on where the data needs to be stored. DBMS is probably the simplest, just update the data in the table. If you are using a J2EE appserver you probably are already using a DBMS.
 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use (stateless) session bean timer (ejb 3.0), how does it sound like?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!