Skip to content

Commit 185d009

Browse files
committed
Move ServerHost into core
1 parent 5602950 commit 185d009

File tree

4 files changed

+15
-36
lines changed

4 files changed

+15
-36
lines changed

src/InEngine/ServerHost.cs renamed to src/InEngine.Core/ServerHost.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using System;
22
using InEngine.Core.Queuing;
33
using InEngine.Core.Scheduling;
4-
using Quartz;
5-
using Quartz.Impl;
64

7-
namespace InEngine
5+
namespace InEngine.Core
86
{
97
public class ServerHost : IDisposable
108
{
@@ -27,10 +25,10 @@ public void Dispose()
2725
public void Start()
2826
{
2927
SuperScheduler.Start();
30-
StartQueueServerAsync();
28+
StartDequeueAsync();
3129
}
3230

33-
public async void StartQueueServerAsync()
31+
public async void StartDequeueAsync()
3432
{
3533
await Dequeue.StartAsync();
3634
}

src/InEngine/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.IO;
33
using System.ServiceProcess;
4+
using InEngine.Core;
45
using Mono.Unix;
56
using Mono.Unix.Native;
67

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,26 @@
1-
using System.Threading;
2-
using System.Threading.Tasks;
3-
using System.Web;
1+
using System.Web;
42
using System.Web.Mvc;
53
using System.Web.Routing;
6-
using InEngine.Core.Queuing;
7-
using InEngine.Core.Scheduling;
4+
using InEngine.Core;
85

96
namespace SampleMvcWebsite
107
{
118
public class Global : HttpApplication
129
{
13-
public SuperScheduler SuperScheduler { get; set; }
14-
public Dequeue Dequeue { get; set; }
10+
public ServerHost ServerHost { get; set; }
1511

1612
protected void Application_Start()
1713
{
1814
AreaRegistration.RegisterAllAreas();
1915
RouteConfig.RegisterRoutes(RouteTable.Routes);
2016

21-
SuperScheduler = new SuperScheduler();
22-
SuperScheduler.Initialize();
23-
SuperScheduler.Start();
24-
Dequeue = new Dequeue();
25-
StartQueueServerAsync();
26-
}
27-
28-
async void StartQueueServerAsync()
29-
{
30-
await Dequeue.StartAsync();
17+
ServerHost = new ServerHost();
18+
ServerHost.Start();
3119
}
3220

3321
protected void Application_End()
3422
{
35-
SuperScheduler?.Shutdown();
23+
ServerHost.Dispose();
3624
}
3725
}
3826
}

src/SampleWebApi/Global.asax.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
using System.Web;
22
using System.Web.Http;
3-
using InEngine.Core.Queuing;
4-
using InEngine.Core.Scheduling;
3+
using InEngine.Core;
54

65
namespace SampleWebApi
76
{
87
public class Global : HttpApplication
98
{
10-
public SuperScheduler SuperScheduler { get; set; }
11-
public Dequeue Dequeue { get; set; }
9+
public ServerHost ServerHost { get; set; }
1210

1311
protected void Application_Start()
1412
{
1513
GlobalConfiguration.Configure(WebApiConfig.Register);
1614

17-
SuperScheduler = new SuperScheduler();
18-
SuperScheduler.Initialize();
19-
SuperScheduler.Start();
20-
21-
Dequeue = new Dequeue();
22-
StartQueueServerAsync();
15+
ServerHost = new ServerHost();
16+
ServerHost.Start();
2317
}
2418

25-
async void StartQueueServerAsync() => await Dequeue.StartAsync();
26-
2719
protected void Application_End()
2820
{
29-
SuperScheduler?.Shutdown();
21+
ServerHost.Dispose();
3022
}
3123
}
3224
}

0 commit comments

Comments
 (0)