It looks like you are talking about the rhino javascript project.this is not
the mailing list for that

On Wed, Mar 25, 2009 at 10:32 PM, JackLet <[email protected]> wrote:

>
> Hi,
>
> I am planning to create a context pool that maintains a list of
> context. and I have some problem about the Context.exit();
>
> My require is base on the following scenario:
> 1. I need to run about 300 thread executing script files downloaded
> from the internet.
> 2. every thread will finish its job in less  than a second, and sleep
> 25 seconds.
> 3. every thread will last 5 mins, and the main thread will start a new
> thread if it found a thread is finished.
>
> according to that design, I should have to create a Context object
> each thread, but I have a new idea:
> How about creating a context pool?
> I create a contest array an give it to a PoolManager, and it should:
> 1. provide a clean(which means that it contains nothing) environment
> Context object when needed, load persistent data(keeping reading and
> you will find it) if the caller gives it any.
> 2. after a context is out of use, it should collect all properties and
> function defined in it and write it to a file or some persistent
> store, and give the persistent reference to the caller thread. finally
> it will do a clean up.
> 3. use some synchronized mechanism to make sure every caller thread
> will use only one context at a time, and a context should "bind" to
> only one caller thread.
>
> It the pool could work, the memory cost will reduce to less than one
> tenth.
>
> BUT, the problem is that, Context will bind to current thread,
> when you create, it will bind a helper instance to it.
>        Object helper = VMBridge.instance.getThreadContextHelper();
>        VMBridge.instance.setContext(helper, cx);
>
> and when you release it, the helper will be removed. but my pool works
> in one thread, there is no other thread to bind!, how to avoiding
> that?
> In fact, I have though out one: put each Context in the pool to a
> wrapper thread, and keep it running.
> but I am no planning to use it.
>
> can you give me some idea about that? thanks you very much :D
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to