Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I had written 4 Classes for Fiber All Blocking Java-API #215

Open
linkerlin opened this issue Jul 29, 2016 · 12 comments
Open

I had written 4 Classes for Fiber All Blocking Java-API #215

linkerlin opened this issue Jul 29, 2016 · 12 comments

Comments

@linkerlin
Copy link

Could I commit them as a PR?

@linkerlin linkerlin changed the title I had written 4 Class for Fiber All Blocking Java-API I had written 4 Classes for Fiber All Blocking Java-API Jul 29, 2016
@linkerlin
Copy link
Author

linkerlin commented Jul 29, 2016

PR #216
Please have a look. @pron @circlespainter
Refer: #197

@fhntv24
Copy link

fhntv24 commented Jul 30, 2016

Is it really async? It's just thread created with task ... Not so much async-ish

@linkerlin
Copy link
Author

@fhntv24 It's really async.
Every request will be wrappered in a Callable, and Callables will be executed in a thread pool.
No new thread created when a task is submit.

@fhntv24
Copy link

fhntv24 commented Jul 31, 2016

It's not real async, it's just blocking thread pool - and this what even you sad. Async means not syncronized ( aka asynchronous ), and you solution is just callback - and this is NOT async. Callbacks != async

You can create real async DNS lookup using NIO, so solution same as JDBC, but I don't think what something better than that is required for DNS lookups. But for massive lookups ( 10k lookups ) - then you would need async DNS. And this is what Quasar is made for - it's for making toons of green threads ( aka fibers )

Also, btw, Netty has async resolvers.
https://github.com/netty/netty/tree/4.1/resolver/src/main/java/io/netty/resolver

p.s. Yes I do know - running in another thread some task is asynchronous too. But IMHO, it's not what Quasar is made for.

@linkerlin
Copy link
Author

linkerlin commented Jul 31, 2016

@fhntv24 UDP is very different from TCP.
NIO is useless when a socket is a udp socket.
UDP is connect-less socket.

@fhntv24
Copy link

fhntv24 commented Aug 1, 2016

Yea, useless ... Right ... So what Netty did is magic ... And also DNS never uses TCP, never!

Actually, DNS can use TCP for large request that are larger than one UDP packet, and you can use NIO for UDP. If you want to, you can use NIO even for IP protocol ( but there is no implementation of such, this is just "theory" ). I did use it for UDP, and it's really easy to do. Please, do not say things that you don't know.

If it's soo different, then how DatagramSocket.receive may know what you are the one who did DNS request? Answer is simple, UDP uses ports too (Incoming and outcoming), and even if there is no real connection - dns must answer to you some-how. Connection-less doesn't mean what you cannot use NIO with it.

edit:
http://stackoverflow.com/questions/16048284/whats-the-point-of-using-udp-with-nio
Read why you should use NIO for UDP. I'm not even speaking about if it's possible or not.

@linkerlin
Copy link
Author

linkerlin commented Aug 1, 2016

@fhntv24 for your infomation : I had released a project BlackHolePy as a DNS proxy which convert UDP DNS requset to TCP。

@pron
Copy link
Contributor

pron commented Aug 3, 2016

Hi. I believe your functionality is already covered by FiberAsync.runBlocking. Isn't it?

@fhntv24
Copy link

fhntv24 commented Aug 4, 2016

@pron yes it is, and @linkerlin just made an bycicle. And he doesn't get what you could write async NIO powered UDP client/server. Also, checkout netty resolver. Yes, netty is pretty big, but maybe it could be an entire library that makes quarsar and netty work together? That would be pretty cool, as there is a lot of netty http clients and other pretty usefull async tools.

@pron
Copy link
Contributor

pron commented Aug 4, 2016

@fhntv24 Please keep your tone respectful; everyone here is trying to help.

@fhntv24
Copy link

fhntv24 commented Aug 4, 2016

@pron sorry, my bad. Also i may try to write DNS resolver using NIO only, but it could take some time.

@linkerlin
Copy link
Author

@pron Happy coding! Waiting for your good news!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants