Ordered downstream events

"Trustin Lee (이희승)" trustin at gmail.com
Thu Apr 29 05:23:26 EDT 2010


Hi,

In my humble opinion, what you really need is a mutex?

    synchronized (encryptionLock) {
        emsg = encrypt(msg);
        channel.write(emsg);
    }

Once Channel.write() is called and it returns, the message is stored in
the write request queue, so the order of write operations is maintained.

HTH,
Trustin

ochtar fear wrote:
> Hi
> 
> Thanks for the great framework. It simplifies my life a lot!
> 
> But there is one little problem to be solved. In our netty-based server to
> interact with clients we use encrypted packets. Our encpypt algorithm is so
> that we need packets to be written to socket exactly in the same order they
> were encrypted, for them to be decoded correctly on client-side. And our
> server is implemented in the way that several packets can be sent from
> different parts (thread pools) simultaniously. I implemented PacketEncoder
> using OneToOneEncoder and added it to the pipeline along with
> LengthPrepender. But there are chances that after one packet in one thread
> will have been encrypted and before it will be written to the socket, other
> packet will be encrypted and written to socket in other thread. So, the
> order will be corrupted.
> 
> Every Channel has its own encryptor with its own parameters. So, I suppose I
> need something like ExecutionHandler with OrderedMemoryAwareThreadPool
> forwarding not upstream but downstream events to ThreadPool. Looking through
> the user guide and API reference I can't seem to find anything like this.
> 
> The question is: am I missing something? Or do I need to implement this kind
> of Handler by myself?
> 
> Thanks in advance.
> 
> PS: Sorry for my english.

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100429/d135c787/attachment-0001.bin 


More information about the netty-users mailing list