thrift 笔记
来源:互联网 发布:java时间加一秒 编辑:程序博客网 时间:2024/06/18 03:40
一、如何获取client的实例
#pragma once
#include "f:\thirdparty\thrift\thrift-0.9.0\lib\cpp\src\thrift\server\tserver.h"
using namespace apache::thrift::server;
class ServerEventHandler :
public TServerEventHandler
{
public:
ServerEventHandler(void);
~ServerEventHandler(void);
virtual void* createContext(boost::shared_ptr<TProtocol> input, boost::shared_ptr<TProtocol> output);
virtual void deleteContext(void* serverContext, boost::shared_ptr<TProtocol>input, boost::shared_ptr<TProtocol>output);
};
void* ServerEventHandler::createContext(boost::shared_ptr<TProtocol> input, boost::shared_ptr<TProtocol> output)
{
theApp.AddClient(input->getTransport());
return NULL;
}
void ServerEventHandler::deleteContext(void* serverContext, boost::shared_ptr<TProtocol>input, boost::shared_ptr<TProtocol>output)
{
theApp.RemoveClient(input->getTransport());
}
m_thriftServer->setServerEventHandler(boost::shared_ptr<ServerEventHandler>(new ServerEventHandler()));
二、
如何设置接收和发送缓存的大小
#pragma once
#include "f:\thirdparty\thrift\thrift-0.9.0\lib\cpp\src\thrift\transport\tbuffertransports.h"
using namespace apache::thrift::transport;
class BufferedTransportFactory :
public TBufferedTransportFactory
{
public:
BufferedTransportFactory(int rwSize);
~BufferedTransportFactory(void);
public:
virtual boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> trans)
{
return boost::shared_ptr<TTransport>(new TBufferedTransport(trans, (uint32_t)m_rwSize));
}
private:
int m_rwSize;
};
shared_ptr<TTransportFactory> transportFactory(new BufferedTransportFactory(1024));
- thrift 笔记
- thrift笔记
- # thrift 笔记
- Thrift白皮书阅读笔记
- Thrift笔记--Hello,world
- Thrift 学习笔记
- Thrift学习笔记
- Thrift学习笔记
- Thrift学习笔记
- RPC thrift学习笔记
- thrift 使用笔记
- Cassandra + Thrift 安装使用笔记
- 《Thrift: The Missing Guide》笔记
- Thrift框架学习笔记 IOS/MAC中使用Thrift框架
- Thrift学习笔记(4)--实现Thrift客户端连接池
- Thrift
- thrift
- thrift
- Hibernate Session操作, 查询过滤, 缓存利用, 批量处理
- 黑马程序员——C语言函数部分
- jQuery 相关资料网址
- Hibernate重要规则总结
- git 设置文件忽略
- thrift 笔记
- android.app.DownloadManager分析
- 【BZOJ】【P1115】【POI2009】【石子游戏Kam】【题解】【Nim】
- 《影响力》为你剖析营销的魅力
- Java基础知识--数组
- Js对象
- 初识ServiceWorker
- intellij idea(Android studio)左侧project目录显示的方法
- hibernate---HQL、通用方法的抽取实现