users@grizzly.java.net

Re: Running Grizzly nio at more than one port

From: Alaska <bagirin_at_gmx.de>
Date: Mon, 13 Jul 2009 05:20:57 -0700 (PDT)

Hello Alexey,

Thank you for a rapid answer!

where can I dowload 1.9.17-RC1? is this a right source? :
http://download.java.net/maven/2/com/sun/grizzly/grizzly-framework/1.9.17-SNAPSHOT/

Regards,
alaska




Oleksiy Stashok wrote:
>
> Hi,
>
> I'd recommend to use Grizzly 1.9.17RC1, because we've fixed one issue
> related to your usecase.
> The idea is simple - you need to create 2 TCPSelectorHandlers and add
> them to Controller. Also note, that protocol chain instance handler
> should be assigned not to Controller, in this case, but to each
> SelectorHandler (SelectorHandler.setProtocolChainInstanceHandler())
> separately.
>
> Hope this will help.
>
>
> WBR,
> Alexey.
>
> On Jul 13, 2009, at 12:58 , Alaska wrote:
>
>>
>> Hello!
>>
>> I"m using grizzly-nio-framework + http-webserver (both are v1.9.14),
>> my goal
>> is to run the code below on more than one port.
>> So I need to bind, let us say, the port1 to the parserFilter1 and
>> port2 to
>> parserFilter2 (this should be two different protocols (both on top
>> of the
>> tcp, one is a http and another ist the own one)). Than these protocols
>> should share the same Filters (RequestControllerFilter &
>> ProcessRequestFilter). How could I implement this?
>>
>> Thank you in advance,
>> alaska
>>
>>
>> public void start() throws Exception {
>>
>> final ProtocolFilter parserFilter1 = new
>> AsciiCommandProtocolParserFilter();
>>
>> final ProtocolFilter reqcontrolFilter = new
>> RequestControllerFilter();
>>
>> final Controller controller = new Controller();
>>
>> final TCPSelectorHandler tcp_handler = new
>> TCPSelectorHandler();
>> tcp_handler.setPort(PORT1);
>> tcp_handler.setSelectionKeyHandler(new
>> BaseSelectionKeyHandler());
>>
>> controller.addSelectorHandler(tcp_handler);
>>
>> controller.setReadThreadsCount(_selectorThreadsNumber);
>>
>> final ProtocolChain protocolChain = new DefaultProtocolChain();
>>
>> protocolChain.addFilter(parserFilter1);
>> protocolChain.addFilter(reqcontrolFilter);
>> protocolChain.addFilter(new ProcessRequestFilter());
>>
>> ((DefaultProtocolChain)
>> protocolChain).setContinuousExecution(true);
>>
>> ProtocolChainInstanceHandler pciHandler = new
>> DefaultProtocolChainInstanceHandler() {
>>
>> @Override
>> public ProtocolChain poll() {
>> return protocolChain;
>> }
>>
>> @Override
>> public boolean offer(ProtocolChain pc) {
>> return false;
>> }
>> };
>>
>> controller.setProtocolChainInstanceHandler(pciHandler);
>>
>> try {
>> controller.start();
>> } catch (Exception e) {
>> LOG.log(Level.SEVERE, "Exception in controller...", e);
>> }
>>
>> }
>> --
>> View this message in context:
>> http://www.nabble.com/Running-Grizzly-nio-at-more-than-one-port-tp24459570p24459570.html
>> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/Running-Grizzly-nio-at-more-than-one-port-tp24459570p24460729.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.