• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what the design pattern to be choosed

 
hani Ibrahim
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.
 
Sidharth Pallai
Ranch Hand
Posts: 134
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.
 
peter cooke
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.
 
P Das
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic