本文整理汇总了C#中Thrift.Transport.TTransport类的典型用法代码示例。如果您正苦于以下问题:C# TTransport类的具体用法?C# TTransport怎么用?C# TTransport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TTransport类属于Thrift.Transport命名空间,在下文中一共展示了TTransport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TFramedTransport
public TFramedTransport(TTransport transport)
{
if (transport == null)
throw new ArgumentNullException("transport");
this.transport = transport;
InitWriteBuffer();
}
示例2: TBufferedTransport
public TBufferedTransport(TTransport transport, int bufSize = 1024)
{
if (transport == null)
throw new ArgumentNullException("transport");
if (bufSize <= 0)
throw new ArgumentException("bufSize", "Buffer size must be a positive number.");
this.transport = transport;
this.bufSize = bufSize;
}
示例3: GetClient
public static Cassandra.Client GetClient(string keyspace, ref TTransport transport)
{
TTransport frameTransport = new TFramedTransport(new TSocket("localhost", 9160));
TProtocol frameProtocol = new TBinaryProtocol(frameTransport);
var client = new Cassandra.Client(frameProtocol, frameProtocol);
frameTransport.Open();
client.set_keyspace(keyspace);
transport = frameTransport;
return client;
}
示例4: Connection
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
internal Connection(Server server)
{
Created = DateTime.Now;
Server = server;
TTransport socket = new TSocket(server.Host, server.Port, server.Timeout);
_transport = new TFramedTransport(socket);
_protocol = new TBinaryProtocol(_transport);
_client = new Cassandra.Client(_protocol);
}
示例5: ReturnInstance
/// <summary>
/// return an instance.
/// </summary>
/// <param name="instance"></param>
public void ReturnInstance(TTransport instance)
{
if (objectPool.Count >= config.MaxIdle)
DestoryInstance(instance);
else
{
if (config.ValidateOnReturn)
ValidateOnReturn(instance);
PushObject(instance);
activedCount--;
resetEvent.Set();
}
}
示例6: Services
public Services(TTransport transport)
{
SessionService = new SessionService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => SessionService)));
UserService = new UserService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => UserService)));
SettingService = new SettingService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => SettingService)));
ChatService = new ChatService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => ChatService)));
ChatUserInfoService = new ChatUserInfoService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => ChatUserInfoService)));
ChatGroupService = new ChatGroupService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => ChatGroupService)));
InboxService = new InboxService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => InboxService)));
InboxRuleService = new InboxRuleService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => InboxRuleService)));
ElifService = new ElifService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => ElifService)));
SearchService = new SearchService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => SearchService)));
NotificationService = new NotificationService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => NotificationService)));
}
示例7: ReturnConnection
public void ReturnConnection(TTransport transport)
{
lock (locker) {
if (idelCount == Conf.TMaxIdel)
DestoryInstance(transport);
else
{
if (Conf.TValidateOnReturn)
ValidateInstance(transport);
PushToPool(transport);
resetEvent.Set();
}
}
}
示例8: Connection
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
internal Connection(Server server, int timeout = 0)
{
Created = DateTime.Now;
Server = server;
Timeout = timeout;
//TcpClient client = new TcpClient(server.Host, server.Port);
//client.NoDelay = true;
//client.SendBufferSize = timeout;
//client.ReceiveTimeout = timeout;
//TTransport socket = new TSocket(client);
TTransport socket = new TSocket(server.Host, server.Port, timeout);
_transport = new TFramedTransport(socket);
_protocol = new TBinaryProtocol(_transport);
_client = new Cassandra.Client(_protocol);
}
示例9: initClient
private void initClient()
{
transport = new TFramedTransport(new TSocket(SERVER_IP, SERVER_PORT, TIME_OUT));
TProtocol protocol = new TBinaryProtocol(transport);
client = new BigQueueService.Client(protocol);
transport.Open();
}
示例10: Connection
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
internal Connection(Server server, ConnectionBuilder builder)
{
Created = DateTime.Now;
Server = server;
var socket = new TSocket(server.Host, server.Port, server.Timeout * 1000);
switch(builder.ConnectionType)
{
case ConnectionType.Simple:
_transport = socket;
break;
case ConnectionType.Buffered:
_transport = new TBufferedTransport(socket, builder.BufferSize);
break;
case ConnectionType.Framed:
_transport = new TFramedTransport(socket);
break;
}
_protocol = new TBinaryProtocol(_transport);
_client = new Cassandra.Client(_protocol);
}
示例11: InitTransportAndClient
/// <summary>
///
/// </summary>
private void InitTransportAndClient()
{
var socket = new TSocket(Server.Host, Server.Port, Server.Timeout * 1000);
switch (ConnectionType)
{
case ConnectionType.Simple:
_transport = socket;
break;
case ConnectionType.Buffered:
_transport = new TBufferedTransport(socket, BufferSize);
break;
case ConnectionType.Framed:
_transport = new TFramedTransport(socket);
break;
default:
goto case ConnectionType.Framed;
}
var protocol = new TBinaryProtocol(_transport);
_client = new Cassandra.Client(protocol);
}
示例12: GetClient
public static Cassandra.Client GetClient()
{
if (_client == null)
{
if (_transport == null) _transport = new TFramedTransport(new TSocket("localhost", 9160));
var client = new Cassandra.Client(new TBinaryProtocol(_transport));
if (!_transport.IsOpen)
{
try
{
_transport.Open();
}
catch (Exception e)
{
Utility.Logging("transport open fail:" + e.Message);
}
}
if (!_setKeySpace)
{
client.set_keyspace(_keySpace);
_setKeySpace = true;
}
//return client;
_client = client;
}
return _client;
}
示例13: EpmService
public EpmService()
{
disposed = false;
pool = new ConnectionProvider();
transport = pool.GetConnection();
TProtocol protocol = new TBinaryProtocol(transport);
client = new Datahouse.Client(protocol);
}
示例14: DNHClientComponent
/// <summary>
/// DNHClientComponent
/// </summary>
public DNHClientComponent()
{
InitializeComponent();
transport = new TSocket(hostName, port);
protocol = new TBinaryProtocol(transport);
client = new DNHService.Client(protocol);
}
示例15: Setup
public void Setup()
{
var socket = new TSocket(host, port);
transport = new TFramedTransport(socket);
var protocol = new TBinaryProtocol(transport);
Client = new ZipkinCollector.Client(protocol);
transport.Open();
}