I'm working on an application which, like many, displays a subset of a large data set with Next Page/Previous Page links. This seemed like a perfect application of the Value List Handler pattern.
My question, however, is this. It mentions that the Value List Handler is cached on the server side. Where is a good place to cache this list? One of the requirements of the application I'm working on is that the amount of "stuff" placed in the user's session should be minimized. Also, the number of user working concurrently is huge. So I cannot use a session bean strategy of VLH.
Is the user's session the only place that makes sense for this? Or is there somewhere else it can be cached and tied to that particular user?
If I dont keep the data in a cache then I need to re execute the query for next subset of data. So I have to keep it as statefull. This again creates a overhead since there will be lot of users.
Thanks in advance for your help...
SCJP (310-035) 84% | SCEA 91%
Joined: Jan 15, 2007
Joined: Jul 15, 2006
You can store the cache on whatever place you see suitable. For example you can store it in the user session or you can store the data in an XML file on the server. Any solution that makes the best performance is welcome. [ November 28, 2007: Message edited by: Khaled Mahmoud ]
Originally posted by Khaled Mahmoud: You can store the cache on whatever place you see suitable. For example you can store it in the user session or you can store the data in an XML file on the server. Any solution that makes the best performance is welcome.
[ November 28, 2007: Message edited by: Khaled Mahmoud ]
WoooooooooooooW .... the file store is not a good practice remember... the design of your application must consider the cluster situation, in that case you can't use the disk as session storage. btw, the specification forbids that, if you use the java.io to store files you could lead to a non compliant application.
about your answer, use the http session because it will be forwarded to other servers if you are in a cluster environment, avoid the static variable solution due to the same problem.
If I dont keep the data in a cache then I need to re execute the query for next subset of data.
However, if your dataset is large, and you have a large number of users, you may run out of memory if you store a large dataset for each user. Instead, you may want to take advantage of the built in pagination features of EJB3/JPA--in particular, the setMaxResults and setFirstResults methods. You would need to run a new query for each page that a user sees, but your memory consumption would be much less. This is a tradeoff that we make in our applications for large lists.
This has nothing to do with the Sun Certified Enterprise Architect exam or assignments. This may be one of the reasons you got no responses last time you posted this, and it took so long to get a response this time - you were asking the question to people who were coming to this forum for another reason.