Created
May 19, 2013 00:20
-
-
Save scramjet/5606195 to your computer and use it in GitHub Desktop.
Example of using a Java wrapper with Netty 4 to work around Clojure bug http://dev.clojure.org/jira/browse/CLJ-1183.
This file contains 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
package name.mattp; | |
import io.netty.bootstrap.ServerBootstrap; | |
import io.netty.bootstrap.Bootstrap; | |
import io.netty.channel.Channel; | |
import io.netty.channel.ChannelFuture; | |
import io.netty.channel.ChannelPipeline; | |
import io.netty.channel.ChannelHandler; | |
import io.netty.channel.ServerChannel; | |
import io.netty.channel.EventLoopGroup; | |
import io.netty.channel.ChannelOption; | |
import io.netty.channel.ChannelHandlerContext; | |
public class Netty | |
{ | |
public static ChannelFuture close (Channel channel) | |
{ | |
return channel.close (); | |
} | |
public static ChannelFuture flush (Channel channel) | |
{ | |
return channel.flush (); | |
} | |
public static ChannelFuture write (Channel channel, Object message) | |
{ | |
return channel.write (message); | |
} | |
public static ChannelPipeline pipeline (Channel channel) | |
{ | |
return channel.pipeline (); | |
} | |
public static ServerBootstrap channel (ServerBootstrap bootstrap, | |
Class<? extends ServerChannel> channelClass) | |
{ | |
return bootstrap.channel (channelClass); | |
} | |
public static Bootstrap clientChannel (Bootstrap bootstrap, | |
Class<? extends Channel> channelClass) | |
{ | |
return bootstrap.channel (channelClass); | |
} | |
public static Bootstrap group (Bootstrap bootstrap, EventLoopGroup group) | |
{ | |
return bootstrap.group (group); | |
} | |
public static Bootstrap handler (Bootstrap bootstrap, | |
ChannelHandler handler) | |
{ | |
return bootstrap.handler (handler); | |
} | |
public static Bootstrap option (Bootstrap bootstrap, | |
ChannelOption option, | |
Object value) | |
{ | |
return bootstrap.option (option, value); | |
} | |
public static ChannelPipeline pipeline (ChannelHandlerContext ctx) | |
{ | |
return ctx.pipeline (); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment