Question on LocalChannel

Frederic Bregier fredbregier at free.fr
Wed Jul 8 12:25:24 EDT 2009


Hmm, after testing more with the current version from svn, it seems that now
I see the thread changing on server LocalChannel side, so showing me that
the ExecutionHandler is doing what is supposed to do.

So I think I have my answers (but please correct me if I'm wrong):
- Is it useful in my case to have an executionHandler in the LocalChannel? :
probably yes

- How to have parallelism between LocalChannels? : be sure to write to the
LocalChannel and forget it so that the ExecutionHandler of the LocalChannel
will do the rest...

Sorry for those verbose questions...

Cheers,
Frederic


Frederic Bregier wrote:
> 
> Thanks Trustin,
> 
> as always, fast an precise!!
> 
> It works perfectly, both in the example and my project!!!
> 
> Just two questions however:
> 
> With an ExecutionHandler (Ordered one for instance) in the pipeline, is it
> useful when using a LocalChannel or not?
> 
> And since my idea was to do like this:
> - external client through network writes to one remote NetworkChannel of
> the Server using an OrderedThreadPool ExecutionHandler (since I want the
> message to be computed in order in the final point)
> - this NetworkChannel write internally to one of the Server side
> LocalChannel (demultiplexing) using an OrdederThreadPool (if necessary)
> 
> The idea would be:
> 
> n server local channels writes to 1 network channel -> receive on 1
> network channel splitting into n server local channels
> 
> Each of the server local channels must complete their task in order, but
> they can do this completely in parallel from the others. That is to say, I
> don't need any synchronisation between all local channel, but keeping the
> order of the message in one local channel.
> 
> What I observered (and this is logic for me), is that as all messages are
> ordered by the first ExecutionHandler in the NetworkChannel, all
> subsequent works on local channel are sequential even if they concern
> different local channels (so independent so parallel).
> 
> Have you any idea on how to enable ordered message in final in each local
> channel but separately, while keeping as much as possible of parallelism ?
> 
> Frederic
> 
> 
> Trustin Lee wrote:
>> 
>> Fixed at revision 1535.  It was a silly mistake. ;)
>> 
>> On 07/08/2009 10:08 PM, 이희승 (Trustin Lee) wrote:
>>> Will take a look soon.. :)
>>> 
>>> Thanks,
>>> Trustin
>>> 
>>> On 07/08/2009 09:57 PM, Frederic Bregier wrote:
>>>> Hi,
>>>>
>>>> I've made some other tests today and I was able to reproduce the same
>>>> error
>>>> than in my project.
>>>> But the error is not stable (sometimes it runs ok, sometimes not, let
>>>> say 1
>>>> on 3 times).
>>>>
>>>> I use the last version you just published for testing on AIX. And I've
>>>> got
>>>> the same problem (under windows) with this LocalChannel example.
>>>>
>>>> I modify a bit the code in order to check the status of the connection
>>>> and
>>>> to print out the exception and to really return back...
>>>> Here is what I've got:
>>>>
>>>> ...
>>>> Start 1
>>>> [id: 0x01bac748] OPEN
>>>> [id: 0x01bac748] CONNECT: local:1
>>>> [id: 0x01bac748, local:ephemeral] BOUND: local:ephemeral
>>>> [id: 0x01bac748, local:ephemeral] CONNECTED: local:1
>>>> [id: 0x01bac748, local:ephemeral] WRITE: First
>>>> [id: 0x01bac748, local:ephemeral] WRITTEN_AMOUNT: 1
>>>> [id: 0x01bac748, local:ephemeral] WRITE: Second
>>>> [id: 0x01bac748, local:ephemeral] WRITTEN_AMOUNT: 1
>>>> [id: 0x01bac748, local:ephemeral] WRITE: Third
>>>> [id: 0x01bac748, local:ephemeral] WRITTEN_AMOUNT: 1
>>>> [id: 0x01bac748, local:ephemeral] WRITE: quit
>>>> [id: 0x01bac748, local:ephemeral] WRITTEN_AMOUNT: 1
>>>> [id: 0x01bac748, local:ephemeral] CLOSE
>>>> [id: 0x01bac748, local:ephemeral => local:1] DISCONNECTED
>>>> [id: 0x01bac748, local:ephemeral => local:1] UNBOUND
>>>> [id: 0x01bac748, local:ephemeral => local:1] CLOSED
>>>> End 1
>>>> Start 2
>>>> [id: 0x004b222f] OPEN
>>>> [id: 0x004b222f] CONNECT: local:1
>>>> CANNOT CONNECT
>>>> java.net.ConnectException: connection refused
>>>> 	at
>>>> org.jboss.netty.channel.local.LocalClientChannelSink.connect(LocalClientChannelSink.java:122)
>>>> 	at
>>>> org.jboss.netty.channel.local.LocalClientChannelSink.eventSunk(LocalClientChannelSink.java:79)
>>>> 	at
>>>> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:791)
>>>> 	at
>>>> org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:66)
>>>> 	at
>>>> org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:590)
>>>> 	at
>>>> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:796)
>>>> 	at
>>>> org.jboss.netty.example.local.LocalExampleMultiple$PrintHandler.handleDownstream(LocalExampleMultiple.java:116)
>>>> 	at
>>>> org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:590)
>>>> 	at
>>>> org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:585)
>>>> 	at org.jboss.netty.channel.Channels.connect(Channels.java:762)
>>>> 	at
>>>> org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:195)
>>>> 	at
>>>> org.jboss.netty.bootstrap.ClientBootstrap$Connector.channelOpen(ClientBootstrap.java:287)
>>>> 	at
>>>> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:103)
>>>> 	at
>>>> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:567)
>>>> 	at
>>>> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:562)
>>>> 	at org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:197)
>>>> 	at
>>>> org.jboss.netty.channel.local.DefaultLocalChannel.<init>(DefaultLocalChannel.java:64)
>>>> 	at
>>>> org.jboss.netty.channel.local.DefaultLocalClientChannelFactory.newChannel(DefaultLocalClientChannelFactory.java:48)
>>>> 	at
>>>> org.jboss.netty.channel.local.DefaultLocalClientChannelFactory.newChannel(DefaultLocalClientChannelFactory.java:1)
>>>> 	at
>>>> org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:235)
>>>> 	at
>>>> org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:199)
>>>> 	at
>>>> org.jboss.netty.example.local.LocalExampleMultiple.main(LocalExampleMultiple.java:77)
>>>>
>>>> Here are the new codes:
>>>>
>>>> http://n2.nabble.com/file/n3225269/LocalExampleMultiple.java
>>>> LocalExampleMultiple.java 
>>>> http://n2.nabble.com/file/n3225269/LocalServerPipelineFactory.java
>>>> LocalServerPipelineFactory.java 
>>>>
>>>> HTH,
>>>> Frederic
>>>>
>>>> -----
>>>> Hardware/Software Architect
>>> 
>>> _______________________________________________
>>> netty-dev mailing list
>>> netty-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/netty-dev
>> 
>> _______________________________________________
>> netty-dev mailing list
>> netty-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-dev
>> 
>> 
> 
> 


-----
Hardware/Software Architect
-- 
View this message in context: http://n2.nabble.com/Question-on-LocalChannel-tp3222132p3226471.html
Sent from the Netty Developer Group mailing list archive at Nabble.com.




More information about the netty-dev mailing list