Beispiel #1
0
        public override int run(string[] args)
        {
            shutdownOnInterrupt();
            IWindowLogger logger = UnityContainerHost.Container.Resolve <IWindowLogger>();

            try
            {
                string endpoint = string.Format("default:tcp -p {0}", SettingManager.GetInstance.DataServer.SubPort);
                _ic = communicator();
                ObjectAdapter adapter = _ic.createObjectAdapterWithEndpoints("AASDataServer", endpoint);

                IceDataService dataService = new IceDataService();
                adapter.add(dataService, _ic.stringToIdentity("AASDataServer/DataServant"));
                adapter.activate();
                _isRunning = true;
                logger.Warn(Title, "已启动!");
                _ic.waitForShutdown();
                if (interrupted())
                {
                    logger.Error(Title, "已中断!");
                    return(1);
                }
                logger.Warn(Title, "已停止!");
                _isRunning = false;
                return(0);
            }
            catch (System.Exception ex)
            {
                _isRunning = false;
                logger.Error(Title, "运行出错!", ex);
                return(1);
            }
        }
Beispiel #2
0
        public int Stop()
        {
            try
            {
                if (_dataAdapter != null && _isRunning == true)
                {
                    _isRunning = false;

                    _dataCount        = 0;
                    _orderCount       = 0;
                    _orderQueueCount  = 0;
                    _transactionCount = 0;

                    _dataAdapter.NewMarketData       -= PubMarketData;
                    _dataAdapter.NewMarketOrder      -= PubMarketOrder;
                    _dataAdapter.NewMarketOrderQueue -= PubMarketOrderQueue;
                    _dataAdapter.NewMarketTransction -= PubMarketTransction;

                    if (_isTransport == true)
                    {
                        _dataThreadGZip.Abort();
                        _orderThreadGZip.Abort();
                        _orderQueueThreadGZip.Abort();
                        _transactionThreadGZip.Abort();
                    }
                    else
                    {
                        _dataThread.Abort();
                        _orderThread.Abort();
                        _orderQueueThread.Abort();
                        _transactionThread.Abort();
                        //_replyThread.Abort();
                    }

                    _logger.Warn(SENDER, "已停止!");
                }
                else
                {
                    _logger.Warn(SENDER, "未运行!");
                }
            }
            catch (Exception ex)
            {
                _logger.Error(SENDER, "停止失败!", ex);
                return(1);
            }

            return(0);
        }
Beispiel #3
0
 void _dataAdapter_NewSysEvent(string obj)
 {
     _logger.Warn("数据源服务", obj);
 }