Closed GoogleCodeExporter closed 8 years ago
The main issues seems the fact that both the ServerManager and the
ConsumerManager
(not ClientManager) classes have static members. This should be fixed.
Once the static members are taken care of, can you use the two manager classes
as
they are in your EJB implementation? If not, can you just use composition or
inheritance to create the right class?
I don't see why would you introduce interfaces. These are top level helper
classes,
there is no contract here.
Original comment by mscurte...@pingidentity.com
on 6 Feb 2007 at 1:17
Ok, I wasn't aware that ServerManager and ConsumerManager were simply top-level
helper classes, in the sense that there is no contract for them (officially).
Since
the samples show each "manager" being used by even higher level code, I wonder
if it
would be worthwhile to standardize these Managers (?)
Regardless, I'm not sure that the ServerManger or ConsumerManager need to be
"fixed"
with regard to static AssociationStores. For a typical servlet implemention on
a
single server, it might be a good solution. However, for J2EE, they (perhaps)
should
be re-written to use Entity bean persistence, or some other in-memory
Association
mechanism that can be replicated across servers).
Anyway, inheritence would work for everything except the AssociationStores (I
guess
these could be ignored, or overridden in my subclass). In my opinion, these
Manager
classes should be interfaced for clarity, and for the next guy that comes along
who
wants to create an impl for BEA or Oracle or some other server.
At the least, it may make sense to have an intermediate abstract class for each
Manager that has everything minus the AssociationStore. That way, non-abstract
implemenations can implement the store however they want. My $.02 -- what do
you think?
Original comment by sappenin
on 6 Feb 2007 at 4:39
With revision 81 we removed all static members, in both the manager and sample
classes.
Both association stores are defined as interfaces, and very simple
implementations
are defined. For a production system you should definitely use your own
implementation (and they should be very easy to implement).
The sample classes just give an example of how you would use the managers, still
don't think an interface is needed.
I hope the other issues were addresses by removing the static fields.
Original comment by mscurte...@pingidentity.com
on 6 Feb 2007 at 6:45
Original comment by marius.s...@gmail.com
on 6 Feb 2007 at 8:17
Thanks for the above changes (especially the Association stores).
For the in-memory Managers, however, if the Manager doesn't use static fields,
is it
ok to just declare the Manager as a non-static member variable of a servlet
(e.g.,
similar to what SampleConsumer does)?
Does a servlet get instantiated once at runtime? Or is it init'd and destroyed
periodically? If the latter is the case, then we might inadvertently lose
association data, since its not static.
If the servlet is created once at runtime, then this won't be an issue.
Original comment by sappenin
on 6 Feb 2007 at 11:33
Servlets get instantiated and initialized only once. But you still bring up a
very
good point. Currently the two manager classes are not thread-safe, and this is a
major issue in a servlet environment.
I am closing this issue and we will open a new issue regarding thread-safety.
Keep them coming :-)
Original comment by marius.s...@gmail.com
on 7 Feb 2007 at 2:05
Original issue reported on code.google.com by
sappenin
on 5 Feb 2007 at 6:12