dev@grizzly.java.net

Re: TCP Connections and Threading

From: Mark Macumber <mark.macumber_at_gmail.com>
Date: Tue, 22 Jul 2008 20:23:11 +1000

Hi Alexey,

Thanks a lot, I must have been looking all all the wrong places, thanks for
the tip!

On Tue, Jul 22, 2008 at 6:18 PM, Oleksiy Stashok <Oleksiy.Stashok_at_sun.com>
wrote:

> Hello Mark,
> it's easy:
>
> controller.getPipeline().setMaxThreads(25);
>
>
> WBR,
> Alexey.
>
> On Jul 22, 2008, at 5:50 , Mark Macumber wrote:
>
> Hi Everyone,
>
> I was working on a very basic HTTP server using Grizzly 1.8.0 to stress
> test it to see if it could handle a certain load required for our project,
> and I got it working pretty well.
>
> It was easy to configure the amount of worker threads for processing etc...
>
> It was like this: (basically)
>
> *SelectorThread st = new SelectorThread();
> st.setPort(port);
> st.setAdapter(new SampleAdapter());
> st.setProperty("maxThreads", 25);
>
> st.listen();*
>
> Easy...
>
> Now I wanted to mimic this type of thing with TCP, to handle many TCP
> requests and process their results. I have something like the following:
>
> *Controller controller = new Controller();
>
> TCPSelectorHandler tcpSelectorHandler = new TCPSelectorHandler();
> tcpSelectorHandler.setPort(port);
> controller.addSelectorHandler(tcpSelectorHandler);
>
> new Thread(new Runnable() {
> public void run() {
> try {
> _log.info("GBSTP TCP Server Started");
> controller.start();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> }).start();*
>
> Based on examples I saw.
>
> How exactly can I configure the amount of "worker" threads that will
> process the TCP connections? (like in the HTTP example above)
>
> I am open to many ideas here!
>
> Cheers,
> Mark
>
>
>