|
@@ -1,29 +0,0 @@
|
|
|
-using System;
|
|
|
-using System.Collections.Concurrent;
|
|
|
-
|
|
|
-namespace WingCloudServer.State
|
|
|
-{
|
|
|
- public class BaseServiceRunStateManager
|
|
|
- {
|
|
|
- protected ConcurrentDictionary<ServiceEnum,BaseServiceRunState<ServiceStateEnum>> ServerStateDictionary { get; set; } = new();
|
|
|
-
|
|
|
- public void SetServiceState(ServiceEnum serviceEnum, ServiceStateEnum serviceStateEnum)
|
|
|
- {
|
|
|
- ServerStateDictionary.AddOrUpdate(serviceEnum, f=> {
|
|
|
- var serviceState = new BaseServiceRunState<ServiceStateEnum>();
|
|
|
- serviceState.ExecuteSwitch(serviceStateEnum);
|
|
|
- return serviceState;
|
|
|
- },
|
|
|
- (f,v)=>{
|
|
|
- v.ExecuteSwitch(serviceStateEnum);
|
|
|
- return v;
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- public BaseServiceRunState<ServiceStateEnum> GetServiceState(ServiceEnum serverInstance)
|
|
|
- {
|
|
|
- ServerStateDictionary.TryGetValue(serverInstance, out BaseServiceRunState<ServiceStateEnum> serviceStateDictionary);
|
|
|
- return serviceStateDictionary;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|