Created
July 3, 2012 12:45
-
-
Save trustin/3039522 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.nio.channels.FileChannel myFile = ...; | |
java.nio.channels.SocketChannel mySocket = java.nio.channels.SocketChannel.open(); | |
// Perform some blocking operation here. | |
... | |
// Netty takes over. | |
SocketChannel ch = new NioSocketChannel(mySocket); | |
EventLoopGroup group = ...; | |
group.register(ch); | |
... | |
// Deregister from Netty. | |
ch.deregister().sync(); | |
// Perform some blocking operation here. | |
mySocket.configureBlocking(false); | |
myFile.transferFrom(mySocket, ...); | |
// Register back again to another event loop group. | |
EventLoopGroup anotherGroup = ...; | |
anotherGroup.register(ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment