private int GenerateAndDeployUnreliableTransportSettings() { string filePath = System.IO.Path.Combine(this.nodeSettings.DeploymentFoldersInfo.WorkFolder, UnreliableTransportSettings.SettingsFileName); DeployerTrace.WriteNoise("Writing Unreliable Transport Settings file at {0}", filePath); UnreliableTransportSettings unreliableTransportSettings = new UnreliableTransportSettings(this.clusterSettings); // acquiring lock to read and write to unreliable transport settings file. FileLock fileLock = new FileLock(filePath, false /* writing lock */); if (!fileLock.Acquire(new TimeSpan(0, 0, 5))) { DeployerTrace.WriteWarning("Failed to acquire lock to load Unreliable Transport Settings File. Aborting loading at file: {0}", filePath); return(Constants.ErrorCode_Failure); } // checks if it necessary to merge if (!File.Exists(filePath)) { // writes the result to Unreliable Transport Settings File unreliableTransportSettings.WriteUnreliableTransportSettingsFile(filePath); } else { // creates a new UnreliableTransportSettings from existing UnreliableTransportSettings file UnreliableTransportSettings unreliableTransportSettingsExisting = new UnreliableTransportSettings(filePath); // merge files giving precedence to settings coming from cluster manifest unreliableTransportSettingsExisting.Merge(unreliableTransportSettings); // writes the result to Unreliable Transport Settings File unreliableTransportSettingsExisting.WriteUnreliableTransportSettingsFile(filePath); } #if DotNetCoreClrLinux Helpers.UpdateFilePermission(filePath); #endif // releasing lock. fileLock.Release(); return(Constants.ErrorCode_Success); }