You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Thrift.Protocol;
|
|
using Thrift.Server;
|
|
using Thrift.Transport;
|
|
namespace XGL.Thrift
|
|
{
|
|
public class ThriftCommon
|
|
{
|
|
|
|
public void Start(ThriftServiceImp buninessImp)
|
|
{
|
|
TServerSocket serverTransport = null;
|
|
ThriftService.Processor processor = null;
|
|
TServer server = null;
|
|
try
|
|
{
|
|
serverTransport = new TServerSocket(7911, 0, false);
|
|
processor = new ThriftService.Processor(buninessImp);
|
|
server = new TThreadedServer(processor, serverTransport);
|
|
server.Serve();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
server.Stop();
|
|
serverTransport.Close();
|
|
}
|
|
}
|
|
|
|
public void Start(ThriftServiceImp buninessImp,int Port)
|
|
{
|
|
TServerSocket serverTransport = null;
|
|
ThriftService.Processor processor = null;
|
|
TServer server = null;
|
|
try
|
|
{
|
|
serverTransport = new TServerSocket(Port, 0, false);
|
|
processor = new ThriftService.Processor(buninessImp);
|
|
server = new TThreadedServer(processor, serverTransport);
|
|
server.Serve();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
server.Stop();
|
|
serverTransport.Close();
|
|
}
|
|
}
|
|
}
|
|
}
|