//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(); // /// // /// Python日志服务状态 // /// // public const string _shareLogServerStatus = "OK"; // /// // /// 获取Thrift服务单例 // /// // 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); // } // } //}