commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vijay <vijay.dai...@gmail.com>
Subject Re: POOL - Question about different time out for borrow and add object
Date Wed, 29 Apr 2015 19:55:57 GMT
Hi Phil..

Thanks for response. i agree that add object is not problem as i am pre
filling the pool and i can wait until the pool gets filled. But the real
prob is with borrow object where i have to call the external system if
there are no idle objects and the pool didn't reach the max size.

In this case the pool will try to create new object by using factory make
object method. The same method which add object also uses to add object to
pool. I this case the borrow objeect call will get blocked until new
connection is provided by external system (This could be some time more
than 5 mins)

The factory instance of the pool at this particular point has no
information of whether the call has happened from borrow object or add
object of pool to handle the time out based on add or borrow...This is
where iam stuck ...

can you help me how to implement it ..

Thanks

On Wed, Apr 29, 2015 at 2:19 PM, Phil Steitz <phil.steitz@gmail.com> wrote:

> On 4/29/15 8:59 AM, vijay wrote:
> > Hi ,
> >
> > I want to know if i can achieve this. Is there any way to specify time
> out
> > for the addobject and borrow object methods?
> >
> > What i am really looking is when i start the pool i am prefilling it with
> > add object for this i can wait for more time to geth the pool
> initialized.
> > The backned system i have takes more time to crate connections
> >
> > But at the time of borrow i cannot have the client wait for long time if
> no
> > idle connection is available and the factory make object method might
> take
> > more time to  return object.
> >
> > So is there anyway i can tall factory method to wait for x time for add
> > obkject and y time for borrow object calls
>
> There is no timeout for addObject.  It is just a no-op if there is
> no capacity to add to the pool when you call it.  If you are
> prefilling at startup, that should not be a problem.  If you
> actually *want* a timeout for the adds, then you need to implement
> it in your factory itself.
>
> Phil
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message