12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- //using System;
- //using System.Threading;
- //using Thrift.Protocol;
- //using Thrift.Server;
- //using Thrift.Transport;
- //namespace WWPipeLine.Commons
- //{
- // public class PythonShareLog
- // {
- // public delegate void SendMsg(string msg, string type);
- // //Python日志推送事件
- // public static event SendMsg SendMsgEvent;
- // private static string _instance = null;
- // private static object _instanceLock = new object();
- // /// <summary>
- // /// Python日志服务状态
- // /// </summary>
- // public const string _shareLogServerStatus = "OK";
- // /// <summary>
- // /// 获取Thrift服务单例
- // /// </summary>
- // public static string Instance
- // {
- // get
- // {
- // if (_instance == null)
- // {
- // lock (_instanceLock)
- // {
- // if (_instance == null)
- // {
- // _instance = _shareLogServerStatus;
- // ThreadPool.QueueUserWorkItem((s) => { new PythonShareLog().InitServer(); });
- // }
- // }
- // }
- // return _instance;
- // }
- // set { _instance = value; }
- // }
- // private void InitServer(bool isReptile = false)
- // {
- // try
- // {
- // TServerSocket reptile_ServerTransport = new TServerSocket(8848);
- // ShareLogService shareLog = new ShareLogService();
- // ShareLog.Processor logProcessor = new ShareLog.Processor(shareLog);
- // shareLog.SendMsgEvent -= ShareLog_SendMsgEvent;
- // shareLog.SendMsgEvent += ShareLog_SendMsgEvent; ;
- // TMultiplexedProcessor process = new TMultiplexedProcessor();
- // process.RegisterProcessor("LogShareServer", logProcessor);
- // TServer server = new TThreadPoolServer(process, reptile_ServerTransport);
- // server.Serve();
- // }
- // catch (Exception ex)
- // {
- // Commons.LogHelper.Error(ex);
- // }
- // }
- // private void ShareLog_SendMsgEvent(string msg, string type)
- // {
- // SendMsgEvent?.Invoke(msg, type);
- // }
- // }
- //}
|