首页下载资源后端NETTY教程笔记啊啊

ZIPNETTY教程笔记啊啊

Litter_mang_tuo3.86MB需要积分:1

资源文件列表:

Netty教程源码资料.zip 大约有9个文件
  1. Netty教程源码资料/大纲/
  2. Netty教程源码资料/大纲/Netty-大纲.pdf 216.5KB
  3. Netty教程源码资料/大纲/Netty-大纲.xmind 144.5KB
  4. Netty教程源码资料/代码/
  5. Netty教程源码资料/代码/netty-代码.zip 554.92KB
  6. Netty教程源码资料/讲义/
  7. Netty教程源码资料/讲义/Netty-讲义.zip 2.72MB
  8. Netty教程源码资料/资料/
  9. Netty教程源码资料/资料/nio.pdf 270.55KB

资源介绍:

NETTY教程笔记啊啊
http://gee.cs.oswego.edu
Scalable IO in Java
Doug Lea
State University of New York at Oswego
dl@cs.oswego.edu
http://gee.cs.oswego.edu
http://gee.cs.oswego.edu
Outline
"
Scalable network services
"
Event-driven processing
"
Reactor pattern
Basic version
Multithreaded versions
Other variants
"
Walkthrough of java.nio nonblocking IO APIs
http://gee.cs.oswego.edu
Network Services
"
Web services, Distributed Objects, etc
"
Most have same basic structure:
Read request
Decode request
Process service
Encode reply
Send reply
"
But differ in nature and cost of each step
XML parsing, File transfer, Web page
generation, computational services, ...
http://gee.cs.oswego.edu
Classic Service Designs
client
client
client
Server
read
decode
compute
encode
send
read
decode
compute
encode
send
handler
handler
read
decode
compute
encode
send
handler
Each handler may be started in its own thread
http://gee.cs.oswego.edu
Classic ServerSocket Loop
class Server implements Runnable {
public void run() {
try {
ServerSocket ss = new ServerSocket(PORT);
while (!Thread.interrupted())
new Thread(new Handler(ss.accept())).start();
// or, single-threaded, or a thread pool
} catch (IOException ex) { /* ... */ }
}
static class Handler implements Runnable {
final Socket socket;
Handler(Socket s) { socket = s; }
public void run() {
try {
byte[] input = new byte[MAX_INPUT];
socket.getInputStream().read(input);
byte[] output = process(input);
socket.getOutputStream().write(output);
} catch (IOException ex) { /* ... */ }
}
private byte[] process(byte[] cmd) { /* ... */ }
}
}
Note: most exception handling elided from code examples
100+评论
captcha