For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > December 2004 > Tree-like data structure in J2EE









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Tree-like data structure in J2EE
SMMT

2004-12-10, 3:57 pm

Hi,

In my project I'm trying to use the Value Object Patern (aka Bulck Data Object Patern)
Nut, my VOs can refer to other VOs like a tree in witch a node can refer to another node.
Is a structure like this one, is possible that in some point a VO references a VO in its owner upper
structure , like this

A -> B -> C -> A

The problem when loading this VO is that I get a infinite loop.
The client requests a VO from the server. In the server, a facade Stateless Session Bean is in
charge of compiling the request. For this , the bean consults various entity beans constructing the
various VO.
So to parcialy resolve the problem I use a POJO that acts as a memory (a cache). Each time a VO is
loaded is added to the memory. The next time is requested, the cached object is returned.
This works fine, the problem is that by caching the objects I lose control if they are updated or
not since another separated process is in charge of saving the VO send by the client. (this process
is implemented in the stateless bean). So, when saving I remove the object from the loading memory,
and when loading I remove the object from the saving memory. (the same loop occurs when saving, so
use the memory to avoid saving the same object over and over).

For a single client acessing the server this works , but for multiple clientes I have a serious
cuncurrency problem. Because this is becaming very non-standard I ask you if anyone had a similar
problem and how it was workedarround. Or, if there is a special pattern for this kind of VO. Or, if
anyone as any idea , at all, that can help solving the cunccurency problem.

Thanks in advance.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com