Index: /trunk/sources/HeuristicLab.Clients.OKB/3.3/HeuristicLab.Clients.OKB-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Clients.OKB/3.3/HeuristicLab.Clients.OKB-3.3.csproj (revision 14731)
+++ /trunk/sources/HeuristicLab.Clients.OKB/3.3/HeuristicLab.Clients.OKB-3.3.csproj (revision 14732)
@@ -114,4 +114,9 @@
+
+ True
+ True
+ Settings.settings
+
@@ -177,4 +182,8 @@
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
Index: /trunk/sources/HeuristicLab.Clients.OKB/3.3/Properties/Settings.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Clients.OKB/3.3/Properties/Settings.Designer.cs (revision 14732)
+++ /trunk/sources/HeuristicLab.Clients.OKB/3.3/Properties/Settings.Designer.cs (revision 14732)
@@ -0,0 +1,46 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace HeuristicLab.Clients.OKB.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("\r\n\r\n WSHttpBinding_IQueryService\r\n")]
+ public global::System.Collections.Specialized.StringCollection EndpointConfigurationPriorities {
+ get {
+ return ((global::System.Collections.Specialized.StringCollection)(this["EndpointConfigurationPriorities"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("3")]
+ public int MaxEndpointRetries {
+ get {
+ return ((int)(this["MaxEndpointRetries"]));
+ }
+ }
+ }
+}
Index: /trunk/sources/HeuristicLab.Clients.OKB/3.3/Properties/Settings.settings
===================================================================
--- /trunk/sources/HeuristicLab.Clients.OKB/3.3/Properties/Settings.settings (revision 14732)
+++ /trunk/sources/HeuristicLab.Clients.OKB/3.3/Properties/Settings.settings (revision 14732)
@@ -0,0 +1,15 @@
+
+
+
+
+
+ <?xml version="1.0" encoding="utf-16"?>
+<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <string>WSHttpBinding_IQueryService</string>
+</ArrayOfString>
+
+
+ 3
+
+
+
Index: /trunk/sources/HeuristicLab.Clients.OKB/3.3/Query/QueryClient.cs
===================================================================
--- /trunk/sources/HeuristicLab.Clients.OKB/3.3/Query/QueryClient.cs (revision 14731)
+++ /trunk/sources/HeuristicLab.Clients.OKB/3.3/Query/QueryClient.cs (revision 14732)
@@ -24,4 +24,5 @@
using System.IO;
using System.Linq;
+using System.ServiceModel;
using HeuristicLab.Clients.Common;
using HeuristicLab.Common;
@@ -39,4 +40,7 @@
}
}
+
+ private int endpointRetries;
+ private string workingEndpoint;
#region Properties
@@ -68,5 +72,5 @@
}
public void RefreshAsync(Action exceptionCallback) {
- var call = new Func(delegate() {
+ var call = new Func(delegate () {
try {
Refresh();
@@ -76,5 +80,5 @@
return null;
});
- call.BeginInvoke(delegate(IAsyncResult result) {
+ call.BeginInvoke(delegate (IAsyncResult result) {
Exception ex = call.EndInvoke(result);
if (ex != null) exceptionCallback(ex);
@@ -156,6 +160,34 @@
#region Helpers
+ private QueryServiceClient NewServiceClient() {
+ if (endpointRetries >= Properties.Settings.Default.MaxEndpointRetries)
+ return CreateClient(workingEndpoint);
+
+ var configurations = Properties.Settings.Default.EndpointConfigurationPriorities;
+ Exception exception = null;
+
+ foreach (var endpointConfigurationName in configurations) {
+ try {
+ var cl = CreateClient(endpointConfigurationName);
+ cl.Open();
+ workingEndpoint = endpointConfigurationName;
+ return cl;
+ } catch (EndpointNotFoundException e) {
+ exception = e;
+ ++endpointRetries;
+ }
+ }
+
+ throw exception ?? new EndpointNotFoundException("No endpoint for Query service found.");
+ }
+
+ private QueryServiceClient CreateClient(string endpointConfigurationName) {
+ var cl = ClientFactory.CreateClient(endpointConfigurationName);
+ return cl;
+ }
+
private T CallQueryService(Func call) {
- QueryServiceClient client = ClientFactory.CreateClient();
+ QueryServiceClient client = NewServiceClient();
+
try {
return call(client);
Index: /trunk/sources/HeuristicLab.Clients.OKB/3.3/app.config
===================================================================
--- /trunk/sources/HeuristicLab.Clients.OKB/3.3/app.config (revision 14731)
+++ /trunk/sources/HeuristicLab.Clients.OKB/3.3/app.config (revision 14732)
@@ -1,4 +1,9 @@
+
+
+
+
+
@@ -63,3 +68,18 @@
-
+
+
+
+
+
+ WSHttpBinding_IQueryService
+
+
+
+
+ 3
+
+
+
+