Of course an alternate approach is to go back to what was done with EJB 2.x to
support unittestability - place all of the methods into another object, and
make the SLSB a mere facade for that object. Then each SLSB method would look
like:
void doSomething(int var) {
new RealObject(var).doSome
Thanks for sharing your insights on this issue!
"ALRubinger" wrote : Sure, but you've set up a maintenance "gotcha" that is
pretty easy to violate and will be difficult to debug. Also, you'll be less
likely to see the inconsistencies exhibited in development, meaning it's likely
that Peter's
"vanyatka" wrote : ...if I only run one single facade method, and previous old
state doesn't bug me (all variables are re-initialized before used), can such
"temporal" use of fields be justified?
Sure, but you've set up a maintenance "gotcha" that is pretty easy to violate
and will be difficult
"ALRubinger" wrote : SLSBs *do* have state, as the instance is returned to the
Pool after use. Therefore invocation-specific data should not be kept in
instance members of a SLSB.
Thanks, Andrew. This makes good sense. However, if I only run one single facade
method, and previous old state do
Peter is right, though for the wrong reason. :)
SLSBs *do* have state, as the instance is returned to the Pool after use.
Therefore invocation-specific data should not be kept in instance members of a
SLSB. For SFSB this is acceptable (and good practice) because it's guaranteed
that every sub
"PeterJ" wrote : With an SLSB multiple threads can be using it simultaneously
Huh???
What about SLSB pools then? I was sure that a thread takes SLSB instance from
the POOL, executes it and returns it back for later use. Never two threads
execute on the same SLSB instance.
View the original pos
Always pass values as method parameters - do not use fields. With an SLSB
multiple threads can be using it simultaneously and if you use a field you will
get "interesting" results.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171094#4171094
Reply to the po