-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathServerHost.cs
More file actions
49 lines (42 loc) · 1.17 KB
/
ServerHost.cs
File metadata and controls
49 lines (42 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using InEngine.Core.IO;
using InEngine.Core.Queuing;
using InEngine.Core.Scheduling;
namespace InEngine.Core;
public class ServerHost : IDisposable, IHasMailSettings, IHasQueueSettings
{
public SuperScheduler SuperScheduler { get; set; }
public Dequeue Dequeue { get; set; }
public MailSettings MailSettings { get; set; }
public QueueSettings QueueSettings { get; set; }
private bool isDisposed;
public void Start()
{
SuperScheduler = new SuperScheduler();
SuperScheduler.Initialize(MailSettings);
Dequeue = new Dequeue()
{
QueueSettings = QueueSettings,
MailSettings = MailSettings,
};
SuperScheduler.Start();
StartDequeueAsync();
}
public async void StartDequeueAsync() => await Dequeue.StartAsync();
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (isDisposed)
return;
if (!disposing)
return;
SuperScheduler?.Shutdown();
Dequeue.Dispose();
Dequeue = null;
isDisposed = true;
}
}