Beruflich Dokumente
Kultur Dokumente
v
a
o
y
@_
cee-tee-oh@
jf
rog
v
a
o
y
/
m
o
c
.
b
githu
REQUIREMENTS
parallel file Downloads
Parallel Download parts
interrupt/pause/resume
Progress events
Checksum caching
1. No traceable license
2. No website or docs
3. No traceable sources
4.Its an app, not a lib
JAVA.NET.URLCONNECTION
1. Memory wasteful
(buffering)
2. Minimal API
3. Blocking streams
h"p://www.dre.vanderbilt.edu/~schmidt/PDF/reactor-siemens.pdf
h"p://gee.cs.oswego.edu/dl/cpjslides/nio.pdf
In Java, Reactor
means NIO
while (!Thread.interrupted()) {!
selector.select();!
Set selected = selector.selectedKeys();!
Iterator it = selected.iterator();!
while (it.hasNext())!
SelectionKey k = (SelectionKey)(it.next();!
((Runnable)(k.attachment())).run();!
selected.clear();!
}!
NIO LIBRARIES
Most of them are servers
Netty, grizzly, etc.
Apache Mina
Apache HTTP components
asyncclient
Ning http client
NIO LIBRARIES
Most of them are servers
Netty, grizzly, etc
Apache Mina
Apache HTTP components
asyncclient
Ning http client
Request producer
Generates a request message and stream out its
content without buering it in memory
Response consumer
Processes a response message without buering its
content in memory
try$(CloseableHttpAsyncClient1asyncHttpClient1=1HttpAsyncClients.createDefault())1{1
1111asyncHttpClient.start();1
1111Future<HttpResponse>1future1=1asyncHttpClient.execute(1
111111111111HttpAsyncMethods.createGet("http://oss.jfrog.org/api/system/ping"),1
111111111111new$AsyncByteConsumer<HttpResponse>()1{1
1
1111111111111111@Override1
1111111111111111protected$void$onResponseReceived(final$HttpResponse1response)1{1
11111111111111111111System.out.println(response.getStatusLine().getReasonPhrase());1
1111111111111111}1
1
1111111111111111@Override1
1111111111111111protected$void$onByteReceived(final$CharBuffer1buf,1final$IOControl1ioctrl)1{1}1
1
1111111111111111@Override1
1111111111111111protected$void$releaseResources()1{1}1
1
1111111111111111@Override1
1111111111111111protected$HttpResponse1buildResult(final$HttpContext1context)1{1
11111111111111111111return$(HttpResponse)1context.getAttribute("http.response");1
1111111111111111}1
1
111111111111},1null);1
111HttpResponse1response1=1future.get();1
}1
Feature/Library
Maturity
Download
cancela=on
Progress
hooks
Ning
client
Good
Easy
Events
not
granular
enough
Documenta=on
A
bit
sparse
Server-side
counterpart None,
client
only
900
800
700
600
Ning
500
AHAC
400
300
200
100
0
Small
le
Medium le
Large le
h"p://blogs.atlassian.com/2013/07/h"p-client-performance-io/
h"ps://github.com/h"p2/h"p2-spec/issues/46
h"p://www.safaribooksonline.com/library/view/h"p-the-deniave/1565925092/ch04s07.html
Implements SeekableByteChannel
java.nio.channels.FileChannel#write(
java.nio.ByteBuffer
src,
long
position)
FileProgressInfo
FilePartProgressInfo
PersistentFileProgressInfo
Save the total size, sha1, number of parts
State of each part (oset, size, completed...)
VM level
O/S level
HTTP/2
Mostly standardizing Google's
spdy
Header compression
multiplexing (framing)
prioritization
h"p://chimera.labs.oreilly.com/books/1230000000545/ch12.html#REQUEST_RESPONSE_MULTIPLEXING
Reactor pattern
Doug Lea on NIO