public WsdlTemplateBase GetWsdlTemplate(ServiceOperations operations, string baseUri, bool optimizeForFlash, bool includeAllTypesInAssembly, string rawUrl) { var xsd = new XsdGenerator { OperationTypes = operations.AllOperations.Types, OptimizeForFlash = optimizeForFlash, IncludeAllTypesInAssembly = includeAllTypesInAssembly, }.ToString(); var wsdlTemplate = GetWsdlTemplate(); wsdlTemplate.Xsd = xsd; wsdlTemplate.ReplyOperationNames = operations.ReplyOperations.Names; wsdlTemplate.OneWayOperationNames = operations.OneWayOperations.Names; if (rawUrl.ToLower().StartsWith(baseUri)) { wsdlTemplate.ReplyEndpointUri = rawUrl; wsdlTemplate.OneWayEndpointUri = rawUrl; } else { var suffix = GetType().Name.StartsWith("Soap11") ? "soap11" : "soap12"; wsdlTemplate.ReplyEndpointUri = baseUri + suffix; wsdlTemplate.OneWayEndpointUri = baseUri + suffix; } return wsdlTemplate; }
public WsdlTemplateBase GetWsdlTemplate(ServiceOperations operations, string baseUri, bool optimizeForFlash, bool includeAllTypesInAssembly, string rawUrl) { var xsd = new XsdGenerator { OperationTypes = operations.AllOperations.Types, OptimizeForFlash = optimizeForFlash, IncludeAllTypesInAssembly = includeAllTypesInAssembly, }.ToString(); var wsdlTemplate = GetWsdlTemplate(); wsdlTemplate.Xsd = xsd; wsdlTemplate.ReplyOperationNames = operations.ReplyOperations.Names; wsdlTemplate.OneWayOperationNames = operations.OneWayOperations.Names; if (rawUrl.ToLower().Contains("servicestack")) { //var qsPos = rawUrl.IndexOf('?'); //var urlWithoutQueryString = qsPos != -1 ? rawUrl.Substring(0, qsPos) : rawUrl; wsdlTemplate.ReplyEndpointUri = rawUrl; wsdlTemplate.OneWayEndpointUri = rawUrl; } else { wsdlTemplate.ReplyEndpointUri = baseUri + "SyncReply.svc"; wsdlTemplate.OneWayEndpointUri = baseUri + "AsyncOneWay.svc"; } return wsdlTemplate; }
public void Wsdl_state_is_correct() { var serviceOperations = new ServiceOperations(base.AllOperations); var wsdlGenerator = new Soap11WsdlMetadataHandler(); var wsdlTemplate = wsdlGenerator.GetWsdlTemplate(serviceOperations, "http://w3c.org/types", false, false, "http://w3c.org/types"); Assert.That(wsdlTemplate.ReplyOperationNames, Is.EquivalentTo(serviceOperations.ReplyOperations.Names)); Assert.That(wsdlTemplate.OneWayOperationNames, Is.EquivalentTo(serviceOperations.OneWayOperations.Names)); }
public async Task CheckDnsAvailabilityTest() { string location = await NetworkManagementTestUtilities.GetResourceLocation(ResourceManagementClient, "Microsoft.Network/publicIPAddresses"); location = location.Replace(" ", ""); string domainNameLabel = Recording.GenerateAssetName("domainnamelabel"); Response <Models.DnsNameAvailabilityResult> dnsNameAvailability = await ServiceOperations.CheckDnsNameAvailabilityAsync(location, domainNameLabel); Assert.True(dnsNameAvailability.Value.Available); }
// Add MEX namespaces, set the MEX address = to the device address, and adds the // Mex service to the internal device hosted service collection. private void Init() { // Set the service type name to internal to hide from discovery services ServiceTypeName = "Internal"; // Set service namespace ServiceNamespace = new WsXmlNamespace(WsNamespacePrefix.Wsx, WsWellKnownUri.WsxNamespaceUri); // Set the endpoint address EndpointAddress = Device.EndpointAddress; // Add Discovery service operations ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WstNamespaceUri, "Get")); }
/// <exception cref="System.Exception"/> public virtual void TestRootQueueParsing() { CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration(); // non-100 percent value will throw IllegalArgumentException conf.SetCapacity(CapacitySchedulerConfiguration.Root, 90); CapacityScheduler capacityScheduler = new CapacityScheduler(); capacityScheduler.SetConf(new YarnConfiguration()); capacityScheduler.Init(conf); capacityScheduler.Start(); capacityScheduler.Reinitialize(conf, null); ServiceOperations.StopQuietly(capacityScheduler); }
public HelloWorld(IHelloWorld service) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("hel", "hello://Microsoft.WCF.Samples.Adapters"); ServiceID = "urn:uuid:ade3b12c-b46a-4f8f-8da7-4567e405a2bf"; ServiceTypeName = "HelloWorld"; // Add service types here ServiceOperations.Add(new WsServiceOperation("hello://Microsoft.WCF.Samples.Adapters/HelloWorld", "HelloWorld_SayHelloWorld_InputMessageRequest")); // Add event sources here }
public EventingServiceClientProxy(Binding binding, ProtocolVersion version, IEventingServiceCallback callbackHandler) : base(binding, version) { // Set the client callback implementation property m_eventHandler = callbackHandler; // Set client endpoint address m_requestChannel = m_localBinding.CreateClientChannel(new ClientBindingContext(m_version)); // Add client callback operations and event source types ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/EventingService", "SimpleEvent")); EventSources.Add(new DpwsServiceType("SimpleEvent", "http://schemas.example.org/EventingService")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/EventingService", "IntegerEvent")); EventSources.Add(new DpwsServiceType("IntegerEvent", "http://schemas.example.org/EventingService")); }
// Add Ws-Discovery namespaces, set the Discovery service address = to the device address, and adds the // Discovery service to the internal device hosted service collection. private void Init() { // Set the service type name to internal to hide from discovery services ServiceTypeName = "Internal"; // Set service namespace ServiceNamespace = new WsXmlNamespace("wsd", WsWellKnownUri.WsdNamespaceUri); // Set endpoint address EndpointAddress = Device.DiscoVersion.WellKnownAddress; // Add Discovery service operations ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WsdNamespaceUri, "Probe")); ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WsdNamespaceUri, "Resolve")); }
public ServiceHelloWCF(IServiceHelloWCF service, ProtocolVersion version) : base(version) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("ser", "http://localhost/ServiceHelloWCF"); ServiceID = "urn:uuid:1ef46552-0532-4e74-8c9c-635e126924a1"; ServiceTypeName = "ServiceHelloWCF"; // Add service types here ServiceOperations.Add(new WsServiceOperation("http://localhost/ServiceHelloWCF/IServiceHelloWCF", "HelloWCF")); // Add event sources here }
public IServiceHelloWCF(IIServiceHelloWCF service, ProtocolVersion version) : base(version) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("ise", "http://localhost/ServiceHelloWCF"); ServiceID = "urn:uuid:f4c30207-c2cb-493c-8a44-776c1e0ecc7e"; ServiceTypeName = "IServiceHelloWCF"; // Add service types here ServiceOperations.Add(new WsServiceOperation("http://localhost/ServiceHelloWCF/IServiceHelloWCF", "HelloWCF")); // Add event sources here }
public ISmartService(IISmartService service, ProtocolVersion version) : base(version) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("ism", "http://tempuri.org/"); ServiceID = "urn:uuid:72e4b7b5-c0af-48e7-942b-d914719bd38e"; ServiceTypeName = "ISmartService"; // Add service types here ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/ISmartService", "GetMeasurements")); ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/ISmartService", "CreateMeasurement")); // Add event sources here }
public AttachmentService(IAttachmentService service, ProtocolVersion version) : base(version) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("att", "http://schemas.example.org/AttachmentService"); ServiceID = "urn:uuid:6a97c339-8d5e-4c2e-a8a3-d4d109983c8a"; ServiceTypeName = "AttachmentService"; // Add service types here ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/AttachmentService", "OneWayAttachment")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/AttachmentService", "TwoWayAttachment")); // Add event sources here }
// Constructor sets service properties and defines operations and adds event sources public SimpleService(ProtocolVersion version) : base(version) { // Add ServiceNamespace. Set ServiceID and ServiceTypeName ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService"); ServiceID = "urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b90"; ServiceTypeName = "SimpleService"; // Add service operations ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "OneWay")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TwoWayRequest")); // Add event sources DpwsWseEventSource SimpleEvent = new DpwsWseEventSource("sim", "http://schemas.example.org/EventingService", "SimpleEvent"); EventSources.Add(SimpleEvent); this.AddEventServices(); }
public SimpleService(ISimpleService service) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService"); ServiceID = "urn:uuid:6fa33842-ab2e-4eeb-b241-4f735013c4ec"; ServiceTypeName = "SimpleService"; // Add service types here ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "OneWay")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TwoWayRequest")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TypeCheckRequest")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "AnyCheckRequest")); // Add event sources here }
public IService1(IIService1 service, ProtocolVersion version) : base(version) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("ise", "http://tempuri.org/"); ServiceID = "urn:uuid:4f54ab6d-6094-4a73-b485-cdf6ee8aa116"; ServiceTypeName = "IService1"; // Add service types here ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IService1", "getServerAddressWithPort")); ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IService1", "keepAlive")); ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IService1", "isValid")); // Add event sources here }
public SimpleService(ISimpleService service, ProtocolVersion version) : base(version) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService"); ServiceID = "urn:uuid:5b0dd589-9f8c-4c23-b797-01ca3092b1ed"; ServiceTypeName = "SimpleService"; // Add service types here ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "OneWay")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TwoWay")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TypeCheck")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "AnyCheck")); // Add event sources here }
//--// public DpwsDeviceDiscoService(ProtocolVersion v) : base(v) { string wsdNamespace = v.DiscoveryNamespace; // Set the service type name to internal to hide from discovery services ServiceTypeName = "Internal"; // Set service namespace ServiceNamespace = new WsXmlNamespace(WsNamespacePrefix.Wsd, wsdNamespace); // Set endpoint address EndpointAddress = v.DiscoveryWellKnownAddress; // Add Discovery service operations ServiceOperations.Add(new WsServiceOperation(wsdNamespace, "Probe")); ServiceOperations.Add(new WsServiceOperation(wsdNamespace, "Resolve")); m_discovery = new DpwsDeviceDiscovery(v); }
public IDataAccessService(IIDataAccessService service, ProtocolVersion version) : base(version) { // Set the service implementation properties m_service = service; // Set base service properties ServiceNamespace = new WsXmlNamespace("ida", "http://tempuri.org/"); ServiceID = "urn:uuid:358c10f8-ff82-4e9e-977d-236f02d75e7d"; ServiceTypeName = "IDataAccessService"; // Add service types here ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "GetData")); ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "SetData")); ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "SetFileInfo")); ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "GetNestedData")); ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "SetNestedData")); // Add event sources here }
public virtual void TestQueueParsingWithLabelsInherit() { nodeLabelManager.AddToCluserNodeLabels(ImmutableSet.Of("red", "blue")); YarnConfiguration conf = new YarnConfiguration(); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf); SetupQueueConfigurationWithLabelsInherit(csConf); CapacityScheduler capacityScheduler = new CapacityScheduler(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); rmContext.SetNodeLabelManager(nodeLabelManager); capacityScheduler.SetConf(csConf); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(csConf); capacityScheduler.Start(); CheckQueueLabelsInheritConfig(capacityScheduler); ServiceOperations.StopQuietly(capacityScheduler); }
public EventingServiceClientProxy(Binding binding, ProtocolVersion version, IEventingServiceCallback callbackHandler) : base(binding, version) { // Set the client callback implementation property m_eventHandler = callbackHandler; // Set client endpoint address m_requestChannel = m_localBinding.CreateClientChannel(new ClientBindingContext(m_version)); // Add client callback operations and event source types ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/EventingService", "SimpleEvent")); EventSources.Add(new DpwsServiceType("SimpleEvent", "http://schemas.example.org/EventingService")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/EventingService", "IntegerEvent")); EventSources.Add(new DpwsServiceType("IntegerEvent", "http://schemas.example.org/EventingService")); // Add eventing SubscriptionEnd ServiceOperations. By default Subscription End call back to this client ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WseNamespaceUri, "SubscriptionEnd")); this.StartEventListeners(); }
public TestService(string guid, ProtocolVersion version) : base(version) { // Add ServiceNamespace. Set ServiceID and ServiceTypeName ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService"); ServiceID = "urn:uuid:" + guid; ServiceTypeName = "TestService"; // Add additional namesapces if needed // example: Namespaces.Add("someprefix", "http://some/Namespace"); // Add service operations ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "OneWay")); ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TwoWayRequest")); // Add event sources DpwsWseEventSource SimpleEvent = new DpwsWseEventSource("sim", "http://schemas.example.org/EventingService", "SimpleEvent"); EventSources.Add(SimpleEvent); this.AddEventServices(); }
// Token: 0x06000103 RID: 259 RVA: 0x00006BC0 File Offset: 0x00004DC0 public Exception StartService() { AmServiceMonitor.Tracer.TraceDebug <string>((long)this.GetHashCode(), "StartService({0}) called", this.ServiceName); Exception ex = ServiceOperations.RunOperation(delegate(object param0, EventArgs param1) { this.m_scm.Start(); this.WaitForStart(); }); if (ex != null) { ExTraceGlobals.ClusterEventsTracer.TraceError <string, Exception>(0L, "StartService({0}) fails: {1}", this.ServiceName, ex); ReplayEventLogConstants.Tuple_AmFailedToStartService.LogEvent(string.Empty, new object[] { this.ServiceName, ex.ToString() }); } return(ex); }
/// <summary> /// Test init a queue configuration, children's capacity for a given label /// doesn't equals to 100%. /// </summary> /// <remarks> /// Test init a queue configuration, children's capacity for a given label /// doesn't equals to 100%. This expect IllegalArgumentException thrown. /// </remarks> /// <exception cref="System.IO.IOException"/> public virtual void TestQueueParsingFailWhenSumOfChildrenNonLabeledCapacityNot100Percent () { nodeLabelManager.AddToCluserNodeLabels(ImmutableSet.Of("red", "blue")); YarnConfiguration conf = new YarnConfiguration(); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf); SetupQueueConfiguration(csConf); csConf.SetCapacity(CapacitySchedulerConfiguration.Root + ".c.c2", 5); CapacityScheduler capacityScheduler = new CapacityScheduler(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); rmContext.SetNodeLabelManager(nodeLabelManager); capacityScheduler.SetConf(csConf); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(csConf); capacityScheduler.Start(); ServiceOperations.StopQuietly(capacityScheduler); }
public virtual void TestQueueParsingWhenLabelsNotExist() { YarnConfiguration conf = new YarnConfiguration(); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf); SetupQueueConfigurationWithLabels(csConf); CapacityScheduler capacityScheduler = new CapacityScheduler(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); RMNodeLabelsManager nodeLabelsManager = new NullRMNodeLabelsManager(); nodeLabelsManager.Init(conf); nodeLabelsManager.Start(); rmContext.SetNodeLabelManager(nodeLabelsManager); capacityScheduler.SetConf(csConf); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(csConf); capacityScheduler.Start(); ServiceOperations.StopQuietly(capacityScheduler); ServiceOperations.StopQuietly(nodeLabelsManager); }
/// <summary>have the ZK user create the root dir.</summary> /// <remarks> /// have the ZK user create the root dir. /// This logs out the ZK user after and stops its curator instance, /// to avoid contamination /// </remarks> /// <exception cref="System.Exception"/> public virtual void UserZookeeperToCreateRoot() { Runtime.SetProperty("curator-log-events", "true"); CuratorService curator = null; LoginContext login = Login(ZookeeperLocalhost, ZookeeperClientContext, keytab_zk); try { LogLoginDetails(Zookeeper, login); RegistrySecurity.SetZKSaslClientProperties(Zookeeper, ZookeeperClientContext); curator = StartCuratorServiceInstance("ZK", true); Log.Info(curator.ToString()); AddToTeardown(curator); curator.ZkMkPath("/", CreateMode.Persistent, false, RegistrySecurity.WorldReadWriteACL ); ZKPathDumper pathDumper = curator.DumpPath(true); Log.Info(pathDumper.ToString()); } finally { Logout(login); ServiceOperations.Stop(curator); } }
/// <summary> /// Creates an instance of a DpwsClient class with a specified eventing callback port number. /// </summary> public DpwsClient(Binding localBinding, ProtocolVersion v) { m_threadLock = new object(); m_eventClient = new DpwsEventingClient(v); m_mexClient = new DpwsMexClient(v); m_eventCallbacks = new WsServiceOperations(); m_callbackServiceEndpoints = new WsServiceEndpoints(); m_blockingCall = true; m_ignoreRequestFromThisIP = true; m_localBinding = localBinding; m_version = v; m_discoClient = new DpwsDiscoveryClient(this, v); // Add the Hello and Bye discovery disco services ClientDiscoveryService = new DpwsDiscoClientService(this, v); // Start a Udp discovery service host WsUdpServiceHost.Instance.AddServiceEndpoint(ClientDiscoveryService); WsUdpServiceHost.Instance.IgnoreRequestFromThisIP = m_ignoreRequestFromThisIP; WsUdpServiceHost.Instance.MaxThreadCount = 5; WsUdpServiceHost.Instance.Start(new ServerBindingContext(v)); // Add eventing SubscriptionEnd ServiceOperations. By default Subscription End call back // to this client ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WseNamespaceUri, "SubscriptionEnd")); // Add callbacks implemented by this client m_callbackServiceEndpoints.Add(this); // Start the Http service host m_httpServiceHost = new WsHttpServiceHost(m_localBinding, m_callbackServiceEndpoints); m_httpServiceHost.MaxThreadCount = m_callbackServiceEndpoints.Count; m_httpServiceHost.Start(new ServerBindingContext(v)); System.Ext.Console.Write("Http service host started..."); }
public void ServiceOperationsTest() { var serviceOperations = Substitute.For <IPersistedServiceOperations>(); var cachingServiceOperations = new ServiceOperations(serviceOperations); cachingServiceOperations.Remove("1"); serviceOperations.Get("1").Returns(TestDataCreator.Service("1", "2", "3", null)); var service = cachingServiceOperations.Get("1"); Assert.AreEqual("2", service.ApiKey); serviceOperations.Received().Get("1"); serviceOperations.ClearReceivedCalls(); var service2 = cachingServiceOperations.Get("1"); Assert.AreEqual("2", service2.ApiKey); serviceOperations.DidNotReceive().Get("1"); }
internal static void SetOperationTypes(ServiceOperations operationTypes, ServiceOperations allOperationTypes) { ServiceOperations = operationTypes; AllServiceOperations = allOperationTypes; }
internal static void SetOperationTypes(IList<Type> operationTypes, IList<Type> allOperationTypes) { ServiceOperations = new ServiceOperations(operationTypes); AllServiceOperations = new ServiceOperations(allOperationTypes); }
public InstitutionsController() { this.serviceOperations = new ServiceOperations(); }
internal static Exception TryCrashingStoreGracefully() { Exception ex = null; Process storeProcess = null; EventWaitHandle crashControlAckEvent = null; try { ReplayCrimsonEvents.InitiatingGracefulStoreCrash.Log(); storeProcess = ServiceOperations.GetServiceProcess("MSExchangeIS", out ex); if (ex == null) { ex = ServiceOperations.RunOperation(delegate(object param0, EventArgs param1) { if (!RegistryParameters.KillStoreInsteadOfWatsonOnTimeout) { crashControlAckEvent = new EventWaitHandle(false, EventResetMode.ManualReset, "Global\\17B584B2-A9E0-45CF-87CB-7774112D6CB9"); ThreadPool.QueueUserWorkItem(delegate(object param0) { Exception ex2 = ServiceOperations.ControlService("MSExchangeIS", 130); if (ex2 != null) { AmTrace.Debug("ControlService() failed with {0}", new object[] { ex2.Message }); } }); } else { AmTrace.Diagnostic("Killing store instead of taking a Watson dump due to registry override.", new object[0]); } if (crashControlAckEvent != null) { if (crashControlAckEvent.WaitOne(RegistryParameters.StoreCrashControlCodeAckTimeoutInMSec)) { AmStoreServiceMonitor.ReportKillStarted(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (!storeProcess.WaitForExit(RegistryParameters.StoreWatsonDumpTimeoutInMSec)) { AmTrace.Diagnostic("Store process did not finish taking dump in {0} msecs", new object[] { RegistryParameters.StoreWatsonDumpTimeoutInMSec }); } else { AmTrace.Diagnostic("Store process finished taking dump in {0} msecs", new object[] { stopwatch.Elapsed.TotalMilliseconds }); } } else { AmTrace.Diagnostic("Store failed to acknowledge that it received the crash control code in {0} msecs.", new object[] { RegistryParameters.StoreCrashControlCodeAckTimeoutInMSec }); AmStoreServiceMonitor.ReportKillStarted(); } } else { AmStoreServiceMonitor.ReportKillStarted(); } if (!storeProcess.HasExited) { if (crashControlAckEvent != null) { AmTrace.Diagnostic("Store process is still running even after the graceful attempt. Force killing it.", new object[0]); } storeProcess.Kill(); TimeSpan timeSpan = TimeSpan.FromMilliseconds((double)RegistryParameters.StoreKillBugcheckTimeoutInMSec); if (!storeProcess.WaitForExit(RegistryParameters.StoreKillBugcheckTimeoutInMSec)) { ExDateTime storeKillBugcheckDisabledTime = RegistryParameters.StoreKillBugcheckDisabledTime; string text = string.Format("Store process is still running {0} secs after attempt to force kill it.", timeSpan.TotalSeconds); if (storeKillBugcheckDisabledTime > ExDateTime.UtcNow) { AmTrace.Debug("Store bugcheck has been disabled by regkey '{0}' until '{1}'.", new object[] { "StoreKillBugcheckDisabledTime", storeKillBugcheckDisabledTime }); ReplayCrimsonEvents.StoreBugCheckDisabledUntilTime.LogPeriodic <string, string, ExDateTime>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, text, "StoreKillBugcheckDisabledTime", storeKillBugcheckDisabledTime); return; } AmTrace.Debug("Attempting to bugcheck the system. Reason: {0}", new object[] { text }); BugcheckHelper.TriggerBugcheckIfRequired(DateTime.UtcNow, text); return; } else { AmTrace.Diagnostic("Store process has been forcefully killed.", new object[0]); } } }); } } finally { ReplayCrimsonEvents.FinishedGracefulStoreCrash.Log <string>((ex != null) ? ex.Message : "<none>"); if (crashControlAckEvent != null) { crashControlAckEvent.Close(); } if (storeProcess != null) { storeProcess.Dispose(); } } return(ex); }
// Token: 0x0600010F RID: 271 RVA: 0x0000712C File Offset: 0x0000532C private void WaitForStopInternal() { while (!this.m_fShutdown) { Process process = null; ProcessHandle processHandle = null; WaitHandle[] waitHandles = null; int millisecondsTimeout = 30000; try { while (!this.m_fShutdown) { if (this.CheckServiceStatus(ServiceControllerStatus.Stopped)) { AmServiceMonitor.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Service stop detected for {0} based on the result from service controller", this.ServiceName); return; } Exception ex = null; if (process == null) { process = ServiceOperations.GetProcessByIdBestEffort(this.m_serviceProcessId, out ex); if (process == null) { AmServiceMonitor.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Service stop detected for {0} since process is not running anymore", this.ServiceName); return; } try { if (!process.StartTime.Equals(this.m_serviceProcessStartTime)) { AmServiceMonitor.Tracer.TraceDebug <string, DateTime, DateTime>((long)this.GetHashCode(), "Service stop detected for {0} by the change in start times (prev={1}, current={2})", this.ServiceName, this.m_serviceProcessStartTime, process.StartTime); return; } } catch (InvalidOperationException ex2) { AmServiceMonitor.Tracer.TraceError <string, string>((long)this.GetHashCode(), "ps.StartTime for service {0} generated exception {1} . Assuming that the process had exited", this.ServiceName, ex2.Message); return; } if (processHandle == null) { processHandle = new ProcessHandle(); } Exception arg; if (processHandle.TryGetWaitHandle(process, out arg)) { millisecondsTimeout = 30000; waitHandles = new WaitHandle[] { this.m_shutdownEvent, processHandle.WaitHandle }; } else { AmServiceMonitor.Tracer.TraceError <string, Exception>((long)this.GetHashCode(), "WaitForStop({0}) hit exception opening process handle: {1}", this.ServiceName, arg); waitHandles = new WaitHandle[] { this.m_shutdownEvent }; millisecondsTimeout = 5000; } } int num = WaitHandle.WaitAny(waitHandles, millisecondsTimeout); if (num == 0) { AmServiceMonitor.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Shutdown signalled for {0}", this.ServiceName); return; } if (num == 1) { AmServiceMonitor.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Process exit detected for {0}", this.ServiceName); return; } this.OnWaitingForStop(); } } catch (Win32Exception ex3) { AmServiceMonitor.Tracer.TraceError <string, string>((long)this.GetHashCode(), "WaitForStop({0}) encountered exception: {1}", this.ServiceName, ex3.Message); if (!this.HandleKnownException(ex3)) { throw; } } catch (InvalidOperationException ex4) { AmServiceMonitor.Tracer.TraceError <string, string>((long)this.GetHashCode(), "WaitForStop({0}) encountered exception: {1}", this.ServiceName, ex4.Message); if (!this.HandleKnownException(ex4)) { throw; } } finally { if (processHandle != null) { processHandle.Dispose(); processHandle = null; } if (process != null) { process.Dispose(); process = null; } } } }
// Token: 0x0600010D RID: 269 RVA: 0x00006F24 File Offset: 0x00005124 private void WaitForStart() { this.m_serviceProcessId = -1; AmServiceMonitor.Tracer.TraceDebug <string>((long)this.GetHashCode(), "WaitForStart({0}) called", this.ServiceName); while (!this.m_fShutdown) { try { if (this.CheckServiceStatus(ServiceControllerStatus.Running) && this.IsServiceReady()) { Exception ex; using (Process serviceProcess = ServiceOperations.GetServiceProcess(this.ServiceName, out ex)) { if (serviceProcess != null) { Exception ex2 = null; try { this.m_serviceProcessId = serviceProcess.Id; this.m_serviceProcessStartTime = serviceProcess.StartTime; break; } catch (Win32Exception ex3) { ex2 = ex3; } catch (InvalidOperationException ex4) { ex2 = ex4; } if (ex2 != null) { AmTrace.Error("Service status for {0} is Running, but unable to read the process object details. Ex = {1}", new object[] { this.ServiceName, ex2 }); this.m_serviceProcessId = -1; } } else { AmTrace.Error("Service status for {0} is Running, but unable to get the process object", new object[] { this.ServiceName }); } } } if (this.m_shutdownEvent.WaitOne(5000, false)) { break; } this.OnWaitingForStart(); } catch (Win32Exception e) { if (!this.HandleKnownException(e)) { throw; } } catch (InvalidOperationException e2) { if (!this.HandleKnownException(e2)) { throw; } } } }