Exemplo n.º 1
0
        public void Start(Adf.Service.ServiceContext serviceContext)
        {
            this.servername = serviceContext.ServiceName;
            this.version    = this.GetType().Assembly.GetName().Version;
            //
            var cacheManagers = new CacheManager[HASH_POOL_SIZE];

            for (int i = 0; i < HASH_POOL_SIZE; i++)
            {
                cacheManagers[i] = new CacheManager();
            }
            Program.CacheManagers = cacheManagers;
            //
            var port = Adf.ConfigHelper.GetSettingAsInt("Port");

            if (port < 1)
            {
                serviceContext.LogManager.Error.WriteTimeLine("appSetting Port invalid");
                throw new System.Configuration.ConfigurationErrorsException("appSetting Port invalid");
            }
            //
            this.csListen = new Adf.Cs.ServerListen(serviceContext.LogManager);
            //
            this.cleanThread = new System.Threading.Thread(this.CleanHandler);
            this.cleanThread.IsBackground = true;
            this.cleanThread.Start(serviceContext.LogManager);
        }
Exemplo n.º 2
0
        public void Start(Adf.Service.ServiceContext serviceContext)
        {
            this.listen = new Adf.Cs.ServerListen(serviceContext.LogManager);

            //if (serviceContext.Registry.Enable)
            //{
            //    var node = new Dictionary<string, object>();
            //    node.Add("group", serviceContext.Setting.ServiceName);
            //    node.Add("port", this.listen.Port);

            //    serviceContext.Registry.RegisterNode(node);
            //}
        }
Exemplo n.º 3
0
 public void Stop(Adf.Service.ServiceContext serviceContext)
 {
     this.listen.Dispose();
     this.listen = null;
 }