On Dec 2, 2014, at 6:21 AM, Chathuranga wrote:

> I am converting .net program in to node js
> 
> In .Net I used a blocking collection to keep 3rd party objects and it gives 
> one object per request and waits until it filled.
> 
> BlockingCollection<DBAPP> DbDriverPool; //I can keep around 80 objects in 
> that pool. (Due to memory usage) 
> 
> MyProcess(){ 
> 
>    Var obj = DbDriverPool.Take(); 
> 
>    //do taks 
> 
>    DbDriverPool.Add(obj) 
> 
> }
> 
> 
> Every request will get separate obj and requests which doesn't have obj will 
> wait until free obj is added to BlockingCollection.
> 
> I do not want to keep obj in nodejs like this. I only need a function to 
> return integer between 0-80 for each concurrent request and rest of request 
> should wait until integer is available. 
> 
> (I am completely new to node js and also for javascripts) Can someone explain 
> me how to do this?

There are many npm modules that others have written to solve resource-pool 
problems. Here's one:

https://www.npmjs.org/package/generic-pool


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/9046751C-3C00-4439-B22A-BD40C96C9C46%40ryandesign.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to