users@grizzly.java.net

Re: Can support async read/write be used outside of Comet?

From: Luiz Hamilton R L Soares <luizhamilton29_at_yahoo.com.br>
Date: Thu, 13 Sep 2007 18:46:28 -0300 (ART)

Jeanfrancois, thanks for your answer.
> Hi Luiz,
>> Hi,
>>
>> I'm working with Grizzly about two months. It is the core of a LBS
>> Gateway here in Brazil. It is working fine and my code is very
>> simple. I use Controller(), TCPSelectorHandler() classes and a filter, ReadFilter().
>>
>> Well, now I need to implement an Async Server so I can write to a client
>> without a need to wait for a message. Nowadays I can send a message to a
>> client only after my grizzly server receive a message from the
>> client (My TCP server is working like a UDP server!!).
>>
>> I'm reading Grizzly ARP source code, but I can't understand how to use
>> it in a TCP Server. There is an example of ARP, but it is for a HTTP
>> server.
> Right.
  
>> Today I read an answer from Jeanfrancois Arcand in a discuss in this
>> mailing list in 13 Jun 2007 where he was working with the Ericsson team
>> who have requested async write to replace their NIO implementation with
>> Grizzly.
>Right :-) We are still discussing it (was an item on our last meeting,
>which I unfortunately missed).
  
>> Anyboy know if JFA generalize the implementation so it can be used
>> outside of Comet?
>Can you elaborate exactly on what you are looking at? With Comet, async
>read and write are supported, but also the SelectionKey is parked and
>later resumed when the business logic is ready. Are you looking for
>something like that?
  Jeanfrancois, thanks for your answer.
  Well, as I've said, I'm working in a LBS (Location Based System). It has
4.000(and growing) cars as clients. They comunicate with my system through a GSM modem/GPRS to
send their location. I can send message to my clients only when they send
a message, because it register for OP_READ and after my ReadFilter implementation
finish reading, I use its SelectionKey to write a message to them.
  Now I'm looking at how to trigger an event to send a message to my clients without waiting a message from them.
I've realised that SelectionKey is parked, but I don't know how to "wake it up" and register it to OP_WRITE
without receiving a message from it first.
  I managed to do that using HTTP, but I did it just for a test, because my clients use only TCP/IP.
  Thanks again,
  Luiz
  
>For sure I'm interested to help implementing this behavior for TCP :-)
>Thanks!
>-- Jeanfrancois

       Flickr agora em português. Você clica, todo mundo vê. Saiba mais.