Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!