Menu

#6 SpringBeanInvoker getPersistService() always returns true

Next Release
open-fixed
7
2006-04-01
2005-02-22
Isaac Arias
No

The SpringBeanInvoker's getPersistService() always
returns true (it overwrites ServiceInvoker's default).
I'm not sure why it was done this way but I consider it
a bug because it forces every new request to create an
HttpSession object.

Following Spring Framework's best practices and
examples, most beans (classes) that are exposed as
services to remoting clients are stateless in nature.
Spring's BeanFactory naturally caches all "singleton"
beans it creates so there is no benefit I can see in
attaching a reference to them in every user's session.

At least it should be a configurable behavior or,
better still, dynamically determined depending on
Spring's own config. For example, return false if the
bean is a singleton and true otherwise.

I personally prefer the application to be solely in
control of the session and not the framework, but I'm
open to other approaches. If there is a compelling
argument for keeping the behavior as-is, then maybe a
new NonPersistentSpringBeanInvoker can be created that
overwrites this method.

Perhaps the original writer of this invoker is
available to illuminate the original decision for us.

Discussion

  • Isaac Arias

    Isaac Arias - 2005-08-02
    • priority: 5 --> 7
    • assigned_to: nobody --> sullis
     
  • Isaac Arias

    Isaac Arias - 2005-08-02

    Logged In: YES
    user_id=570853

    If it's OK with everyone, here's a patch to remove the method:

    Index: SpringBeanInvoker.java

    RCS file:
    /cvsroot/openamf/openamf/src/java/org/openamf/invoker/SpringBeanInvoker.java,v
    retrieving revision 1.1
    diff -u -r1.1 SpringBeanInvoker.java
    --- SpringBeanInvoker.java 17 Sep 2004 05:01:46 -0000 1.1
    +++ SpringBeanInvoker.java 2 Aug 2005 22:25:26 -0000
    @@ -121,10 +121,6 @@
    return serviceMethod;
    }

    - public boolean getPersistService() {
    - return true;
    - }
    -
    public String getPersistentServiceName() {
    return this.getRequest().getServiceName();
    }

     
  • Sean Sullivan

    Sean Sullivan - 2006-03-29

    Logged In: YES
    user_id=156581

    I committed a fix to CVS.
    The fix will be included in OpenAMF 1.0RC12

     
  • Sean Sullivan

    Sean Sullivan - 2006-03-29
    • status: open --> pending-fixed
     
  • Isaac Arias

    Isaac Arias - 2006-04-01

    Logged In: YES
    user_id=570853

    Thanks Sean. My patch simply removed the method because
    SpringBeanInvoker extends ServiceInvoker, which already
    returns false. I guess your change is more explicit.

     
  • Isaac Arias

    Isaac Arias - 2006-04-01
    • status: pending-fixed --> open-fixed
     

Log in to post a comment.