Announcement Announcement Module
Collapse
No announcement yet.
Pooling a Spring Bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pooling a Spring Bean

    Hi,

    I've looked at the unit test case method testHitMaxSize added to CommonsPoolTargetSourceTests.java. This appears to me to be testing the commons pooling and its ability to know when the max has been hit, rather than testing a pooled spring bean, and Spring's ability to know when the max has been hit.

    I want to be able to add pooling around a spring bean without either the spring bean knowing it has been pooled, or the spring client requesting the spring bean having to know or deal with the bean being pooled.

    It appears from the testHitMaxSize unit test case, that the client needs to know that the bean should be pooled, and that it should also know when to release the bean back to the pool. Is this correct, or have I missed something fundamental?

    As additional information - I'm attempting to use bean pooling to provide a throttling mechanism to protect back-end system resources that could be flooded with requests from the front-end if not adequately protected. Traditionally we would have done this with a pool of EJBs, but now I need a way without EJBs.

    Regards
    Martin

  • #2
    The reference manual has an example of this. The Spring bean doesn't know its being pooled.

    Comment


    • #3
      Checkout also the samples - I think there is a good example of pooling included in there.

      Comment


      • #4
        As additional information - I'm attempting to use bean pooling to provide a throttling mechanism to protect back-end system resources that could be flooded with requests from the front-end if not adequately protected. Traditionally we would have done this with a pool of EJBs, but now I need a way without EJBs
        ConcurrencyThrottleInterceptor. This handles just the throttling, which you are more likely to want, not the pooling (which you are likely not to want).

        Comment

        Working...
        X