[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Field injection tests

alesj do-not-reply at jboss.com
Thu Mar 20 17:54:16 EDT 2008


"scott.stark at jboss.org" wrote : See the updated org.jboss.test.kernel.deployment.support.container.* classes with BeanContainer, BeanPool, etc.
  | 
This BeanPool class looks pretty broken:

  |    public synchronized T createBean()
  |       throws Throwable
  |    {
  |       if(pool.size() == 0)
  |       {
  |          // Fill the pool
  |          for(int n = 0; n < pool.size(); n ++)
  |          {
  |             T bean = (T) factory.createBean();
  |             pool.put(bean);
  |          }
  |       }
  |       return pool.take();
  |    }
  | 
The pool field is never instantiated - unless you're gonna do field injection.
And you have an if on size == 0, and then you iterate till size - which is 0.
OK, I know it's a test class. :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138182#4138182

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138182



More information about the jboss-dev-forums mailing list