Results 1 to 8 of 8

Thread: singletons in app container

  1. #1

    Default singletons in app container

    So we are using struts and jboss with spring.

    Our Action contains a PageBuilder, which contains a service, all wired in spring.

    the action generates a report. on run 1, the values in the report were fine. One subsequent runs, the values are double the previous value.

    This means that the values are persisting in the service between runs, and subsequent runs are adding new data to the old values.

    So in our configuration, the pagebuilder and service bean defs were augmented with singleton=false, but the problem is still there....

    Does the action need a singleton=false attribute?

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Where is the state held that is causing your report problems?

  3. #3

    Default

    the state is held in the service.

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Have you thought about using a <aop:scoped-proxy/>? Basically every request requires a new service, this might be more appropriate.

    Have a read.
    http://www.springframework.org/docs/...factory-scopes

  5. #5

    Default

    karldmoore

    thanx for the reference, it seems like it would work. However we are using 1.2.6, and that only seems available in > 2.0.

    Any other suggestions? I still don't really understand how this is happening -- if i tell the service to not be a singleton, then it should not persist between requests, unless the Action struts creates for the click is itself reused. Ive been in the struts documentation but see any mention of this....

    [edit] -- never mind guys, am dumb, i missed a class that needed to be not-singletoned because I didnt read the struts delegatingactionproxy docs....
    Last edited by shrndegruv; Jan 17th, 2007 at 01:22 PM.

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Have you sorted this then?

  7. #7

    Default

    yes this problem is solved...

  8. #8
    Join Date
    Jul 2005
    Posts
    105

    Default

    Quote Originally Posted by shrndegruv View Post
    ...

    Any other suggestions? I still don't really understand how this is happening -- if i tell the service to not be a singleton, then it should not persist between requests, unless the Action struts creates for the click is itself reused. Ive been in the struts documentation but see any mention of this....
    For what it's worth, it is true that Struts re-uses Actions between requests.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •