Пример #1
0
        public void Run()
        {
            log.InfoFormat("Starting slave service on port {0}.", options.Port);

            TServerTransport transport = null;
            try
            {
                lock (syncRoot)
                {
                    if (stopped)
                        return;

                    var handler = new SlaveServiceHandler();
                    var processor = new VMToolSlaveCustom.Processor(handler);
                    transport = new TServerSocket(options.Port);
                    server = new TThreadPoolServer(processor, transport, message => log.Error(message));
                }

                server.Serve();
                server = null;
            }
            finally
            {
                if (server != null)
                    server.Stop();
                if (transport != null)
                    transport.Close();
            }
        }
Пример #2
0
        public void Run()
        {
            log.InfoFormat("Starting slave service on port {0}.", options.Port);

            TServerTransport transport = null;

            try
            {
                lock (syncRoot)
                {
                    if (stopped)
                    {
                        return;
                    }

                    var handler   = new SlaveServiceHandler();
                    var processor = new VMToolSlaveCustom.Processor(handler);
                    transport = new TServerSocket(options.Port);
                    server    = new TThreadPoolServer(processor, transport, message => log.Error(message));
                }

                server.Serve();
                server = null;
            }
            finally
            {
                if (server != null)
                {
                    server.Stop();
                }
                if (transport != null)
                {
                    transport.Close();
                }
            }
        }