Commit 1e847fad authored by Liuhaoyang's avatar Liuhaoyang

Refactor IBootService

parent 07107922
......@@ -24,6 +24,8 @@ namespace SkyWalking.Boot
{
public interface IBootService : IDisposable
{
int Order { get; }
Task Initialize(CancellationToken token);
}
}
\ No newline at end of file
......@@ -58,13 +58,10 @@ namespace SkyWalking.Boot
public async Task Initialize()
{
var types = FindServiceTypes();
foreach (var type in types)
{
if (Activator.CreateInstance(type) is IBootService service)
foreach (var service in types.Select(Activator.CreateInstance).OfType<IBootService>().OrderBy(x => x.Order))
{
await service.Initialize(_tokenSource.Token);
_services.Add(type, service);
}
_services.Add(service.GetType(), service);
}
}
......
......@@ -31,6 +31,8 @@ namespace SkyWalking.Boot
{
}
public virtual int Order { get; } = 2;
public async Task Initialize(CancellationToken token)
{
await Initializing(token);
......
......@@ -37,6 +37,8 @@ namespace SkyWalking.Sampling
{
}
public int Order { get; } = 1;
public Task Initialize(CancellationToken token)
{
return Task.CompletedTask;
......
......@@ -14,7 +14,4 @@
<ItemGroup>
<ProjectReference Include="..\SkyWalking.Abstractions\SkyWalking.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Remote" />
</ItemGroup>
</Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment