You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Manuel Irribarra <mi...@altiuz.cl> on 2013/11/29 16:28:14 UTC

[pool] Factory example

Hi,

     Following the example page, I noted that Factory example for 
PooleableObjectFactory is wrong. When you extends 
BasePooledObjectFactory<?>, there only 2 methods required:

+ public <?> create()
+ public PooledObject<?> wrap (<?> object)

     I guess that create method must created a new object instance, 
but... ¿how I must use the wrap method?

     Any one have an example?

-- 
*Manuel A. Irribarra Frex*
*Ingeniero de Desarrollo*
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 2335 2461
mirribarra@altiuz.cl <ma...@altiuz.cl>
http://www.altiuz.cl
http://www.altiuzreports.com 	<https://www.facebook.com/altiuz> 
<http://twitter.com/altiuz> <http://www.linkedin.com/company/altiuz>

	


Re: [pool] Factory example

Posted by Manuel Irribarra <mi...@altiuz.cl>.
Thanks Phil, this work great.

On 29/11/13 13:25, Phil Steitz wrote:
> new DefaultPooledObject<Foo>(foo);

-- 
*Manuel A. Irribarra Frex*
*Ingeniero de Desarrollo*
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 2335 2461
mirribarra@altiuz.cl <ma...@altiuz.cl>
http://www.altiuz.cl
http://www.altiuzreports.com 	<https://www.facebook.com/altiuz> 
<http://twitter.com/altiuz> <http://www.linkedin.com/company/altiuz>

	


Re: [pool] Factory example

Posted by Phil Steitz <ph...@gmail.com>.
On 11/29/13, 7:28 AM, Manuel Irribarra wrote:
> Hi,
>
>     Following the example page, I noted that Factory example for
> PooleableObjectFactory is wrong. When you extends
> BasePooledObjectFactory<?>, there only 2 methods required:
>
> + public <?> create()
> + public PooledObject<?> wrap (<?> object)
>
>     I guess that create method must created a new object instance,
> but... ¿how I must use the wrap method?
>
>     Any one have an example?

Yes, create() creates a new object instances.

wrap creates a PooledObject from a newly-created instance.  There is
a DefaultPooledObject implementation provided.  To use that, just use

@Override
 public PooledObject<Foo> wrap(Foo foo) {
    return new DefaultPooledObject<Foo>(foo);
 }
 
Thanks for pointing out the problem with the example page.  It needs to be updated to reflect the new API.  It is still using the old PoolableObjectFactory, which no longer exists.  I will replace this with a working 2.0 example shortly.

Phil


>
> -- 
> *Manuel A. Irribarra Frex*
> *Ingeniero de Desarrollo*
> Altiuz Soluciones Tecnológicas de Negocios Ltda.
> Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
> +56 2 2335 2461
> mirribarra@altiuz.cl <ma...@altiuz.cl>
> http://www.altiuz.cl
> http://www.altiuzreports.com 	<https://www.facebook.com/altiuz>
> <http://twitter.com/altiuz> <http://www.linkedin.com/company/altiuz>
>
> 	
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org