- 授权协议: Apache
- 开发语言: Java
- 操作系统: 跨平台
- 软件首页: https://github.com/facebook/nifty
- 软件文档: https://github.com/facebook/nifty
软件介绍
Nifty是facebook公司开源的,基于netty的thrift服务端和客户端实现。
然后使用此包就可以快速发布出基于netty的高效的服务端和客户端代码。
示例:
public void startServer() {
// Create the handler
MyService.Iface serviceInterface = new MyServiceHandler();
// Create the processor
TProcessor processor = new MyService.Processor<>(serviceInterface);
// Build the server definition
ThriftServerDef serverDef = new ThriftServerDefBuilder().withProcessor(processor)
.build();
// Create the server transport
final NettyServerTransport server = new NettyServerTransport(serverDef,
new NettyConfigBuilder(),
new DefaultChannelGroup(),
new HashedWheelTimer());
// Create netty boss and executor thread pools
ExecutorService bossExecutor = Executors.newCachedThreadPool();
ExecutorService workerExecutor = Executors.newCachedThreadPool();
// Start the server
server.start(bossExecutor, workerExecutor);
// Arrange to stop the server at shutdown
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
server.stop();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
});
}
Or the same thing using guice:
public void startGuiceServer() {
final NiftyBootstrap bootstrap = Guice.createInjector(
Stage.PRODUCTION,
new NiftyModule() {
@Override
protected void configureNifty() {
// Create the handler
MyService.Iface serviceInterface = new MyServiceHandler();
// Create the processor
TProcessor processor = new MyService.Processor<>(serviceInterface);
// Build the server definition
ThriftServerDef serverDef = new ThriftServerDefBuilder().withProcessor(processor)
.build();
// Bind the definition
bind().toInstance(serverDef);
}
}).getInstance(NiftyBootstrap.class);
// Start the server
bootstrap.start();
// Arrange to stop the server at shutdown
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
bootstrap.stop();
}
});
}
Head First EJB(中文版)
KathySierra,Ber / 中国电力出版社 / 2006-9 / 79.00元
有些人只是想通过认证来取悦挑剔的老板,但相信你不是这种人。确实,你也想通过Su n认证业务组件开发人员(SCBCD)考试,但不仅如此,你还需要真正把EJB用到实处。你要构建应用,要对付最后期限,如果通过考试之后第二天早上就把你学过的EJB知识忘得一干二净,你肯定会受不了。 我们会看着你稳稳当当地通过考试,而且会帮你在实际中使用EJB。你会深入地了解EJB体系结构、会话、实体和消息驱动......一起来看看 《Head First EJB(中文版)》 这本书的介绍吧!
HTML 编码/解码
HTML 编码/解码
html转js在线工具
html转js在线工具
