我想创建几个服务,我想使用不同的标识符.
所以我的意思是:
我有一个用户和项目服务.
我想同时使用这些.
我的意思是我可以在xmlrpc上的“handlermap”中添加更多“服务”.
phm.addHandler("Users",
Users.class);
phm.addHandler("Projects",
Projects.class);
我想在节俭中做同样的事情.
这是一个简单的例子:
test.thrift
typedef i64 UserId
struct Bonk
{
1: string message,
2: i32 type
}
struct Insanity
{
1: map userMap,
2: list xtructs
}
service ThriftTest
{
void testVoid(),
string testString(1: string test),
byte testByte(1: byte test),
i32 testI32(1: i32 test),
i64 testI64(1: i64 test),
double testDouble(1: double test),
list> testMap(1: map test),
map testStringMap(1: map test),
set testSet(1: set test),
map> testMapMap(1: i32 test),
map> testInsanity(1: Insanity argument)
}
然后我创建一个implementatino,然后将其添加到TServer的实例.
Users.Processor users_proccesor = new Users.Processor(New UsersImpl());
Projects.Processor project_processor = new Projects.Processors(new ProjectsImp());
// I would like to add Users and Projects
ThriftTest.Processor prc = new ThriftTest.Processor(new ThiftTestImp());
TServerTransport serverTransport = new TServerSocket(9090);
TServer server = new TSimpleServer(new Args(serverTransport).processor( prc ));
这是我的大问题,我无法添加服务器的多个实例.
提前谢谢你的帮助.