Synchronous Mutliplexing in netty
Rahul Patil
rpatil at fusionops.com
Tue Jul 14 00:17:42 EDT 2009
Hi All,
After evaluating few NIO frameworks we settled on netty owing to its
flexible and comprehensive architechture. Now I am struggling with a way to
use netty for synchronous mulitiplexed calls. Following the factorial
example I have been able to address the synchronous part using the following
code:
public Message getMessage(long workID)
{
while (true)
{
try
{
Message am = queue.take();
if(am.getWorkID() == workID){
return am;
}
else
{
queue.offer(am);
}
}
catch (InterruptedException e)
{
// Ignore.
}
}
}
I cannot do a peek as the queue can contain more objects so I need to use
take and offer.
What essentially follows then is to make it multiplexed as we need to make
multiple calls over the same channel to avoid the overhead of using blocking
queue.
I looked at some other pose in this forum and came across LocalChannel.
However, I am not clear about the rationale behind it and not sure how it
can be used for multiplexing.
I ran into xsockets while searching for multiplexing and wondered why this
feature is lacking in netty.
Considering the benefits of netty I don't want to switch to xsocket but I am
stuck with this issue which is hindering our project.
Any help in this matter would be highly appreciated.
--
View this message in context: http://n2.nabble.com/Synchronous-Mutliplexing-in-netty-tp3254213p3254213.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list