Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8694265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:44:44+00:00 2026-06-13T00:44:44+00:00

I am using Spring 3.1 on standalone env. I have scenario where I am

  • 0

I am using Spring 3.1 on standalone env.

I have scenario where I am creating programmatic prototype beans.

each bean has it’s own state.(they are stateful, having unique id and etc..)

After a bean is created I am connecting it to a topic(via DLMC pragmatically).

Each message being sent to the topic contains a specific id(one of the topic’s consumers)

Latency and throughput are very important for me.

So in case i am sending load of messages to a specific bean I am having ridiculous delay between each message since that bean is very busy and it wont be free until it finish it’s current job.

So I thought that I need to create pool of the same bean each time I first create it to avoid such situation.

Any ideas how can I achieve that? Maybe there is a high level solution for that?

I am creating those spring mdbs pragmatically this way:

java code:

MyMdb myMdb= (MyMdb) beanFactory.getBean("MyMdb", id);

and xml:

<bean id="fixSessionMDB" class="com.finbird.fixgw.core.mdb.FixSessionMDB"
    scope="prototype" lazy-init="true">
    <constructor-arg ref="0" />
    <constructor-arg ref="0" />
</bean>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:44:45+00:00Added an answer on June 13, 2026 at 12:44 am

    You aren’t providing too many implementation details, but have a look at the following code snippet:

    <bean id="uniqueConsumerTarget" scope="prototype" lazy-init="true"/>
    
    <bean id="uniqueConsumer" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="targetSource">
            <bean class="org.springframework.aop.target.CommonsPoolTargetSource">
                <property name="targetClass" value="com.example.UniqueConsumer"/>
                <property name="targetBeanName" value="uniqueConsumerTarget"/>
                <property name="maxSize" value="10"/>
                <property name="maxWait" value="5000"/>
            </bean>
        </property>
    </bean>
    

    This code is pretty clever. Every time you ask for "uniqueConsumer" bean, Spring will actually return some dynamic proxy that will intercept all calls. Once you try to execute any method on that bean, Spring will take one instance from the pool (or create new one) and forward to it.

    "maxSize" and "maxWait" parameters are self-descriptive and are used to fine-tune the pool.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Spring3.1 in a standalone env. Although I am using Spring I
Using Spring 2.5 tag library, I have an Integer value in a command form
I am using spring mvc in my application,when i created user i have to
I am using Spring MVC with Hibernate. My page has a button that creates
Here is the problem. I have spring 3.0.5, using its new DATA JPA repository
I asked a question yesterday ( Using Spring in standalone apps ) on how
I'm having some issues with Jetty7 standalone and my spring web app using jsp/jstl/el.
I am using hsqldb standalone as my database. i have a hsqldb.jar(hsqldb-2.0.0) which i
I am using Spring3.1 in standalone Env. I am caching my entry using @Cachable
I am using Spring3.1 in standalone Env. I am trying to cache my entries.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.