Reputation: 14919
Normally you make a call to a service, it blocks until a thread in the pool is available and then it returns a result.
With Netty, or futures in general, you get don't block and return immediately. Only when you actually need the value you call .get() or whatever the API is and then you will block till you receive data back.
When dealing with services, or client/server model, this means you will connect/disconnect from the server more so when doing asych. programming correct? (with the benefit of not blocking).
Is this correct?
Is Netty basically designed using SEDE (staged event-driven architecture) and using Java's NIO data types).
Upvotes: 2
Views: 7233
Reputation: 16066
No.
Using Netty asynchronously means that operations that manage connections and push I/O around are executed in separate threads and the original caller is later informed of the outcome of the requested operations, or an interested listener is called back when there is data available to be read.
Your application threads can block if you want them to, but this is not necessary since you can define a callback that will be executed when the asynchronous operation completes.
When dealing with services, or client/server model, this means you will connect/disconnect from the server more so when doing asych programming correct? (with the benefit of not blocking). Is this correct?
Virtually nothing in that paragraph is correct.
I recommend this tutorial as a better explanation of these fundamental concepts.(full disclosure, I wrote it).
Upvotes: 10