users@grizzly.java.net

Re: UDP problem after restartarting Controller

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 21 Jul 2008 09:58:21 -0400

Salut,

issue tracker is here just in case :-)

https://grizzly.dev.java.net/issues/

A+

-- Jeanfrancois

Oleksiy Stashok wrote:
> Hi,
>
> looks like bug,
> I'll appreciate if you can fill the issue on the issuetracker - I'll
> take a look and fix ASAP.
>
> Thanks.
>
> WBR,
> Alexey.
>
> On Jul 21, 2008, at 15:28 , LittleBear wrote:
>
>>
>> Hi,
>>
>> I am implementing an UDP server (listening on a fixed port) with Grizzly.
>> One of use cases is to start and stop the UDP server without
>> restarting the
>> JVM. So I implemented the start() and stop() methods:
>>
>> public void start() {
>> controller = new Controller();
>>
>> udpSelector = new UDPSelectorHandler();
>> udpSelector.setPort(5555);
>> controller.addSelectorHandler(udpSelector);
>>
>> mySharedPipeline = new DefaultPipeline();
>> controller.setPipeline(mySharedPipeline);
>>
>> pciHandler = new StackInstanceHandler();
>> controller.setProtocolChainInstanceHandler(pciHandler);
>>
>> th = new Thread(controller);
>> th.start();
>> }
>>
>> public void stop() {
>> controller.stop();
>> }
>>
>>
>> The server works fine until I restart it (call stop() then start()).
>> Then I
>> get a strange behaviour in the Filter that parses the messages...
>> The full scenario is:
>>
>> 1. start the server
>> 2. send some (e.g. 5 different) messages from the client, they get
>> parsed,
>> answers are sent, all is Ok
>> 3. restart the server
>> 4. send a new message from the client
>> 5. my Filter.execute() is called, but the buffer is not as expected. It
>> contains bytes from the last message sent in step 2. I get the buffer
>> this
>> way:
>>
>> WorkerThread workerThread = ((WorkerThread) Thread.currentThread());
>> ByteBuffer buffer = workerThread.getByteBuffer();
>>
>>
>> It looks like the bytes from the last message in step 2 remain
>> somewhere in
>> the buffer/socket/controller and are sent to my Filter when a totally new
>> message is received on the socket.
>>
>> I tried also:
>> mySharedPipeline.stopPipeline();
>> udpSelector.shutdown();
>> in the stop() method, but the results were the same.
>>
>>
>> Any idea what could be wrong?
>>
>> --
>> View this message in context:
>> http://www.nabble.com/UDP-problem-after-restartarting-Controller-tp18568653p18568653.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
>