RE: [Simpleweb-Support] Modifying server behavior
Brought to you by:
niallg
|
From: Kevin A. S. <ke...@el...> - 2004-12-01 03:38:38
|
1) How did you make changes for limiting the number of thread?
Here's a code snippet with some initialization and error handling code
removed:
LoaderEngine engine = new LoaderEngine();
// Limit thread pool size to 16?
ProcessQueue.getInstance().resize(16);
Map objects = new HashMap();
// Populate map with service initialization objects
engine.load("ProxyService", ProxyService.class.getName(), objects);
engine.link("*", "ProxyService");
ProtocolHandler handler = HandlerFactory.getInstance(engine);
_server = ConnectionFactory.getConnection(handler);
_socket = new ServerSocket(_port);
_server.connect(_socket);
// Also have tried it here
// ProcessQueue.getInstance().resize(16);
2) What do you mean by "it doesn't appear to have any effect"?
I'm running my code on Gentoo Linux w/Sun's 1.5 JDK. I'm using the
command 'ps | grep java | wc -l' to count the number of threads spawned
by simpleweb. My project has two simpleweb instances listening on two
separate ports. The number returned by that command does not change
despite making the ProcessQueue call. I've tried making the call after
_server.connect() but that seems to have no effect either.
I'm pretty much convinced that I'm doing something wrong, but I'm at a
loss figuring out what it might be.
--Kevin
On Tue, 2004-11-30 at 09:30 +0700, bagas wrote:
> > 1) I'd like to be able to limit the number of threads simpleweb
> creates
> > for request processing. I've tried using the advice given here:
>
> >
> http://sourceforge.net/mailarchive/forum.php?thread_id=5231917&forum_id=
> 38791
>
> > but it doesn't appear to have any effect although its entirely
> possible
> > that I'm doing something wrong :)
>
> Works perfect for me (the sender of question from the URL). Thank you
> Niall.
>
> Can you elaborate on your problem :
> 1. How did you make changes for limiting the number of thread?
> 2. What do you mean by "it doesn't appear to have any effect"? Have you
> test it? How do you test it?
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Simpleweb-Support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simpleweb-support
>
|