You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Julien Vermillard <jv...@gmail.com> on 2012/12/29 10:14:22 UTC

[MINA3] NIO TCP client

Hi,
Just pushed the NioTcpClient (new name for NioTcpConnector).
It's basically working, I need to finish some stuff like connection timeout.
But if you checkout the code it's very simpler than MINA 2 to dig in.

I think the next step would be to test performance with the new test suite,
but it would be nice if more people can review the code.

Julien

Re: [MINA3] NIO TCP client

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 12/30/12 6:16 PM, Julien Vermillard a écrit :
> Yes the timeout doesn't works correctly, I commited the test for Emmanuel.
> Looks like NIO async connect doesnt handle timeout like I thought.

Yep. As NIO is non-blocking, there is no need for a timeout. That means
you can't use the SO_TIMEOUT to detect a dead connection like you did in
your test.

In other words, in order to detect that a connection hasn't received the
data you are expecting - or that the connection is dead -  you have to
use some mechanism close to what we have for idle detection (for read,
this is obviosuly what idle is expected to do, for staled connection,
it's  bit different).

Thanks for the test, Julien !

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: [MINA3] NIO TCP client

Posted by Julien Vermillard <jv...@gmail.com>.
Yes the timeout doesn't works correctly, I commited the test for Emmanuel.
Looks like NIO async connect doesnt handle timeout like I thought.
Julien
Le 30 déc. 2012 17:51, "Alan Cabrera" <li...@toolazydogs.com> a écrit :

>
> On Dec 29, 2012, at 1:14 AM, Julien Vermillard wrote:
>
> > Hi,
> > Just pushed the NioTcpClient (new name for NioTcpConnector).
> > It's basically working, I need to finish some stuff like connection
> timeout.
> > But if you checkout the code it's very simpler than MINA 2 to dig in.
> >
> > I think the next step would be to test performance with the new test
> suite,
> > but it would be nice if more people can review the code.
>
>
> Results :
>
> Failed tests:
>   timeout(org.apache.mina.transport.tcp.NioTcpClientTimeoutTest)
>
> Tests run: 111, Failures: 1, Errors: 0, Skipped: 0
>
>
> -------------------------------------------------------------------------------
> Test set: org.apache.mina.transport.tcp.NioTcpClientTimeoutTest
>
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.01 sec
> <<< FAILURE!
> timeout(org.apache.mina.transport.tcp.NioTcpClientTimeoutTest)  Time
> elapsed: 5.008 sec  <<< FAILURE!
> java.lang.AssertionError
>         at org.junit.Assert.fail(Assert.java:92)
>         at org.junit.Assert.fail(Assert.java:100)
>         at
> org.apache.mina.transport.tcp.NioTcpClientTimeoutTest.timeout(NioTcpClientTimeoutTest.java:52)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>         at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>         at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>         at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>         at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>         at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>         at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>         at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
>         at
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
>         at
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
> org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
>         at $Proxy0.invoke(Unknown Source)
>         at
> org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
>         at
> org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
>         at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
>
>

Re: [MINA3] NIO TCP client

Posted by Alan Cabrera <li...@toolazydogs.com>.
On Dec 29, 2012, at 1:14 AM, Julien Vermillard wrote:

> Hi,
> Just pushed the NioTcpClient (new name for NioTcpConnector).
> It's basically working, I need to finish some stuff like connection timeout.
> But if you checkout the code it's very simpler than MINA 2 to dig in.
> 
> I think the next step would be to test performance with the new test suite,
> but it would be nice if more people can review the code.


Results :

Failed tests: 
  timeout(org.apache.mina.transport.tcp.NioTcpClientTimeoutTest)

Tests run: 111, Failures: 1, Errors: 0, Skipped: 0

-------------------------------------------------------------------------------
Test set: org.apache.mina.transport.tcp.NioTcpClientTimeoutTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.01 sec <<< FAILURE!
timeout(org.apache.mina.transport.tcp.NioTcpClientTimeoutTest)  Time elapsed: 5.008 sec  <<< FAILURE!
java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:92)
	at org.junit.Assert.fail(Assert.java:100)
	at org.apache.mina.transport.tcp.NioTcpClientTimeoutTest.timeout(NioTcpClientTimeoutTest.java:52)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
	at $Proxy0.invoke(Unknown Source)
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)


Re: [MINA3] NIO TCP client

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 12/29/12 10:14 AM, Julien Vermillard a écrit :
> Hi,
> Just pushed the NioTcpClient (new name for NioTcpConnector).
> It's basically working, I need to finish some stuff like connection timeout.
> But if you checkout the code it's very simpler than MINA 2 to dig in.
>
> I think the next step would be to test performance with the new test suite,
> but it would be nice if more people can review the code.

I'll review the code.

Thanks Julien !


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com