首页>电子书>WEB开发>NettyinAction无水印原版pdf

NettyinAction无水印原版pdf

b198cf  在  2020-10-18 09:05:21  上传  5.46 MB
Netty in Action 英文无水印原版pdf

pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开

本资源转载自网络,如有侵权,请联系上传者或csdn删除

查看此书详细信息请在美国亚马逊官网搜索此书
For online information and ordering of this and other Manning books, please visit
www.manning.com.Thepublisheroffersdiscountsonthisbookwhenorderedinquantity
For more information, please contact
pecial Sales Department
Manning publications co
20 Baldwin road
PO BoX 761
Shelter island. nY11964
Emailorders@manning.com
02016 by Manning Publications Co. All rights reserved
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by means electronic, mechanical, photocopying, or otherwise, without prior written
permission of the publisher
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and manning
Publications was aware of a trademark claim, the designations have been printed in initial caps
@o Recognizing the importance of preserving what has been written, it is Mannings policy to have
e publish printed on acid-fl
that end
Recognizing also our responsibility to conserve the resources of our planet, Manning books
are printed on paper that is at least 15 percent recycled and processed without the use of
elemental chlorine
Manning Publications Co.
Development editors: Jeff Bleiel,Jennifer Stout
20 Baldwin road
Technical development editor Mark Elston
PO BOX 761
Copyeditor Andy carroll
Shelter island. ny11964
Proofreader: Elizabeth martin
Technical proofreaders: David Dossot, Neil Rutherford
Typesetter: Dennis dalinnik
Cover designer: Marija Tudor
ISBN:9781617291470
Printed in the United states of america
12345678910-EBM-201918171615

brief contents
PART 1 NETTY CONCEPTS AND ARCHITECTURE
Netty-asynchronous and event-driven 3
Your first Netty application 15
Netty components and design 32
Transports 41
Byte Buf 55
ChannelHandler and ChannelPipeline 75
Eventloop and threading model 96
Bootstrapping 107
Unit testi
g
121
PART 2 CODECS...
131
10 The codec framework 133
11 Provided channelhandlers and codecs 148
PART 3 NETWORK PROTOCOLS
12■ Websocket173
13 Broadcasting events with UDP 187

BRIEF CONTENTS
PART 4 CASE STUDIES
201
14- Case studies, part 1 203
15 Case studies, part 226

contents
preface xn
acknowledgments xvii
this book xx
about the cover illustration xxv
PART 1 NETTY CONCEPTS AND ARCHITECTURE..
1
Netty-asynchronous and event-driven 3
1.1 Networking in Java 4
Java n1o 6. selectors
1.2 Introducing netty 7
Who uses Netty 8 Asynchronous and event-driven 9
1. 3 Netty's core components 10
Channels 10- Callbacks 10. Fut
Events and handlers 12 Putting it all together 13
1. 4 Summary 14

CoNTENTS
2
Your first Netty application 15
2.1 Setting up the development environment 15
Obtaining and installing the Java Development kit 16
Downloading and installing an DE 16 Downloading and
installing Apache Maven 16. Configuring the toolset 17
2.2 Netty client/server overview 17
2.8 Writing the Echo server 18
Channelhandlers and business logic 18 Bootstrapping
the server 20
2.4 Writing an echo client 22
Implementing the client logic with channelhandlers 23
Bootstrapping the client 24
2.5 Building and running the echo server and client 26
Running the build 26 Running the Echo server and client 28
2.6 Summary 31
3
Netty components and design 32
8.1 Channel, EventLoop, and channelfuture 33
Interface Channel 33: Interface Eventloop 33
Interface ChannelFuture 34
3.2 ChannelHandler and channelpipeline 34
Interface Channelhandler 34 Interface ChannelPipeline 35
a closer look at Chanmelhandlers 37. Encoders and
decoders 37. Abstract class simple channellnboundHandler 38
8.8 Bootstrapping 38
8.4 Summary 40
4
Transports 41
4.1 Case study: transport migration 42
N1O with Netty 44. Non-blocking Netty version y 2d
Using o1O and mo without Netty 42. Using o10 a
4.2 Transport API 46
4.3 Included transports 49
N1O--non-blocking 1/0 49. Epoll-native non-blocking
transport for Linux 51.01o--old blocking 1/0 51
Local transport for communication within a /VM 52
Embedded transport 53

CONTENTS
4. Transport use cases 53
4.5 Summary 54
5
te Buf 55
5.1 The byte Buf API 56
5.2 Class Byte Buf--Netty's data container 56
How it works 56 ByteBuf usage patterns 57
5.3 Byte-level operations 60
Random access indexing 60. Sequential access indexing 60
Discardable bytes 61. Readable bytes 61. Writable bytes 62
Index management 62 Search operations 63
Derived bu∥es64·Reod/ mute operations65
More operations 69
5.4 Interface byte BufHolder 69
5.5 Byte Buf allocation 70
On-demand: interface Byte BufAllocator 70. Unpooled
buffers 71 Class Byte BufUtil 72
5.6 Reference counting 72
5.7 Summary 73
ChannelHandler and channelPipeline 75
6.1 The Channelhandler family 75
The Channel lifecycle 76. The Channelhandler lifecycle 76
Interface ChannelInboundhandler 77 a Interface
Channeloutboundhandler 78. Channelhandler adapters 79
Resource management 80
2 Interface ChannelPipeline 82
Modifying a Channelpipeline 83. Firing events 85
6.3 Interface ChannelhandlerContext 87
Using Channelhandlercontext 88 Advanced uses of
Channelhandler and channelhandlercontext 91
6.4 Exception handling 92
Handling inbound exceptions 92- Handling outbound
exceptions 93
6.5 Summary 95

CoNTENTS
Eventloop and threading model 96
7.1 Threading model overview 97
7.2 Interface EventLoop 98
1/0 and event handling in Netly 4 99.1/0 operations
in Netty 3 100
7.8 Task scheduling 100
DK scheduling aPI 100 Scheduling tasks
using Eventloop 101
7.4 Implementation details 103
Thread management 103 EventLoop/thread allocation 104
7.5 Summary 105
8
Bootstrapping 107
8.1 Bootstrap classes 108
8.2 Bootstrapping clients and connectionless protocols 109
Bootstrapping a client 110 Channel and Eventloop group
compatibility 111
8.8 Bootstrapping servers 118
The Server Bootstrap class 113 Bootstrapping a server 114
8.4 Bootstrapping clients from a Channel 115
8.5 Adding multiple channelhandlers during a
bootstrap 117
8.6 Using Netty ChannelOptions and attributes 118
8.7 Bootstrapping Datagram Channels 119
8.8 Shutdown 120
8.9 Summary 120
Unit testing 121
9.1 Overview of Embedded channel 122
9.2 Testing ChannelHandlers with Embedded Channel 128
Testing inbound messages 124 Testing outbound
messages 126
9.3 Testing exception handling 1
g
28
9.4 Summary 150

CONTENTS
PART 2 CODECS
000000
000000000000000000
n131
10
The codec framework 133
10.1 What is a codec? 133
10.2 Decoders 134
Abstract class Byte TomessageDecoder 134 Abstract class
replayingdecoder 136 Abstract class
MessageTolessageDecoder 137. Class
TooLongframeException 138
10.3 Encoders 139
Abstract class MessageTo ByteEncoder 139
Abstract class MessagefomessageEncoder 141
10.4 Abstract codec classes 142
Abstract class Byte lomessage Codec 142
Abstract class message ToMessageCodec 143
Class Combined channelDuplexhandler 146
10.5 Summary 147
Provided channelhandlers and codecs 148
11.1 Securing netty applications with SsL/TLs 148
1. 2 Building Netty Http/hTtps applications 151
httpdecoderencoderandcodec151httpmessage
aggregation153.httpcompression154
Usinghttps155.WebSocket155
11. 3 Idle connections and timeouts 158
11.4 Decoding delimited and length-based protocols 160
Delimited protocols 160. Length-based protocols 163
11.5 Writing
ig data 165
big
1.6 Serializing data 167
DK serialization 167. Serialization with Boss
Marshalling 167 Serialization via Protocol Buffers 169
PART3 NETWORK PROTOCOLS……171
12mbm如
et173
troducing WebSocket 174
12.2 Our example WebSocket application 174
VIP高速任性下载
意见反馈 联系客服 返回顶部

登录注册找回密码

充值账单订单冲正

*扫码按套餐金额一次性付款立即点击“确认”按钮

*充值提示成功,请重新登录账户生效

*充值问题联系Q或邮箱最迟24小时内答复

*充值问题先尝试【订单冲正】自助解决

*无法解决Q421644184或Q邮箱,支付宝订单平台账号

*推荐用chrome浏览器访问本站,禁用360浏览器

啥都没有哦

*输入正确支付宝订单号,2020开头的,点“确认”按钮

*有疑问请及时联系Q 421644184或此Q对应的邮箱

*提供支付宝支付订单号截图及平台用户名

*推荐用chrome浏览器访问本站,禁用360浏览器

在线咨询 x
如果您有任何疑问
点击咨询