using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QM.Exchange.Interface;
namespace QM.Exchange.Core.Services
{
///
/// 服务管理
///
public class ServiceManager
{
//服务器时间同步示例服务
private IService _stService = new ServerTimeService();
//任务队列服务
private IService _taskService = new MessageQueueService();
private void TaskStart(Action action)
{
Task.Factory.StartNew(action);
}
///
/// 启动
///
public void Start()
{
//启动服务器时间同步示例服务
TaskStart(_stService.Start);
//启动消息事件服务
TaskStart(_taskService.Start);
}
///
/// 停止
///
public void Stop()
{
_stService.Stop();
_taskService.Stop();
}
}
}