Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Calendar/3.3/Properties/AssemblyInfo.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Calendar/3.3/Properties/AssemblyInfo.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Calendar/3.3/Properties/AssemblyInfo.cs (revision 4337)
@@ -58,3 +58,3 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3.0.0")]
-[assembly: AssemblyFileVersion("3.3.0.4320")]
+[assembly: AssemblyFileVersion("3.3.0.4333")]
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfSettings.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfSettings.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfSettings.cs (revision 4337)
@@ -100,4 +100,24 @@
}
+ ///
+ /// Securely disposes a WCF client proxy object
+ ///
+ ///
+ public static void DisposeWcfClient(ICommunicationObject obj) {
+ if (obj != null) {
+ if (obj.State != CommunicationState.Faulted &&
+ obj.State != CommunicationState.Closed) {
+ try { obj.Close(); }
+ catch (CommunicationObjectFaultedException) { obj.Abort(); }
+ catch (TimeoutException) { obj.Abort(); }
+ catch (Exception) {
+ obj.Abort();
+ throw;
+ }
+ } else
+ obj.Abort();
+ }
+ }
+
}
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/ServiceLocator.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/ServiceLocator.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/ServiceLocator.cs (revision 4337)
@@ -54,18 +54,5 @@
public static void DisposeClientFacade(IClientFacade clientFacade) {
- ICommunicationObject obj = (ICommunicationObject)clientFacade;
- if (obj != null) {
- if (obj.State != CommunicationState.Faulted &&
- obj.State != CommunicationState.Closed) {
- try { obj.Close(); }
- catch (CommunicationObjectFaultedException) { obj.Abort(); }
- catch (TimeoutException) { obj.Abort(); }
- catch (Exception) {
- obj.Abort();
- throw;
- }
- } else
- obj.Abort();
- }
+ WcfSettings.DisposeWcfClient((ICommunicationObject)clientFacade);
}
}
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/app.config
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/app.config (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/app.config (revision 4337)
@@ -32,6 +32,6 @@
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
transactionFlow="false" transferMode="Streamed" transactionProtocol="OleTransactions"
- hostNameComparisonMode="StrongWildcard" listenBacklog="100"
- maxBufferPoolSize="104857600" maxBufferSize="104857600" maxConnections="100"
+ hostNameComparisonMode="StrongWildcard"
+ maxBufferPoolSize="104857600" maxBufferSize="104857600"
maxReceivedMessageSize="104857600">
x.ToString()).ToArray()) + ")");
}
}
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/SlaveFacade.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/SlaveFacade.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/SlaveFacade.cs (revision 4337)
@@ -94,5 +94,4 @@
public Response IsJobStillNeeded(Guid jobId) {
using (contextFactory.GetContext()) {
- ServiceLocator.GetAuthorizationManager().AuthorizeForJobs(jobId);
return slaveCommunicator.IsJobStillNeeded(jobId);
}
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/app.config
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/app.config (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/app.config (revision 4337)
@@ -53,5 +53,5 @@
+ maxReceivedMessageSize="104857600">
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/ServiceLocator.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/ServiceLocator.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/ServiceLocator.cs (revision 4337)
@@ -5,17 +5,44 @@
using HeuristicLab.Hive.Slave.Communication.SlaveService;
using HeuristicLab.Hive.Contracts;
+using System.ServiceModel;
+using HeuristicLab.Hive.Slave.Communication.Properties;
+using HeuristicLab.Tracing;
namespace HeuristicLab.Hive.Slave.Communication {
internal static class ServiceLocator {
- internal static SlaveFacadeClient CreateSlaveFacade(string hostAddress) {
+ ///
+ /// Cache of SlaveFacadeClients, to check if all get disposed
+ ///
+ private static List clientCache = new List();
+
+ internal static ISlaveFacade CreateSlaveFacade(string hostAddress) {
SlaveFacadeClient client = new SlaveFacadeClient("SlaveHttpEndpoint");
WcfSettings.SetEndpointAddress(client.Endpoint, hostAddress);
+ SetCredentials(client);
+ client.Open();
+ clientCache.Add(client);
+ Logger.Debug("Created SlaveFacadeClients. Currently existing SlaveFacadeClients: " + clientCache.Count);
return client;
}
- internal static SlaveFacadeClient CreateStreamedSlaveFacade(string hostAddress) {
+ internal static ISlaveFacade CreateStreamedSlaveFacade(string hostAddress) {
SlaveFacadeClient client = new SlaveFacadeClient("SlaveTcpStreamedEndpoint");
WcfSettings.SetEndpointAddress(client.Endpoint, hostAddress);
+ SetCredentials(client);
+ client.Open();
+ clientCache.Add(client);
+ Logger.Debug("Created SlaveFacadeClients. Currently existing SlaveFacadeClients: " + clientCache.Count);
return client;
+ }
+
+ private static void SetCredentials(SlaveFacadeClient client) {
+ client.ClientCredentials.UserName.UserName = Settings.Default.HiveUsername;
+ client.ClientCredentials.UserName.Password = Settings.Default.HivePassword;
+ }
+
+ public static void DisposeSlaveClient(ISlaveFacade slaveFacade) {
+ WcfSettings.DisposeWcfClient((ICommunicationObject)slaveFacade);
+ clientCache.Remove(slaveFacade);
+ Logger.Debug("Disposing SlaveFacadeClients. Currently existing SlaveFacadeClients: " + clientCache.Count);
}
}
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/WcfService.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/WcfService.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/WcfService.cs (revision 4337)
@@ -61,5 +61,16 @@
public NetworkEnum.WcfConnState ConnState { get; private set; }
public bool LoggedIn { get; set; }
- public string ServerIP { get; private set; }
+
+ private string serverIp;
+ public string ServerIp {
+ get { return serverIp; }
+ set {
+ if (serverIp != value) {
+ serverIp = value;
+ if (ServerChanged != null)
+ ServerChanged(this, new EventArgs());
+ }
+ }
+ }
public event EventHandler ConnectionRestored;
@@ -67,6 +78,4 @@
public event EventHandler Connected;
- public SlaveFacadeClient proxy = null;
-
///
/// Constructor
@@ -81,7 +90,8 @@
///
public void Connect() {
+ SlaveService.ISlaveFacade client = null;
try {
Logger.Debug("Starting the Connection Process");
- if (String.Empty.Equals(ServerIP)) {
+ if (String.Empty.Equals(ServerIp)) {
Logger.Info("No Server IP set!");
return;
@@ -89,58 +99,28 @@
Logger.Debug("Creating the new connection proxy");
- proxy = ServiceLocator.CreateStreamedSlaveFacade(ServerIP);
+ client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
Logger.Debug("Created the new connection proxy");
- Logger.Debug("Registring new Events");
- proxy.GetStreamedJobCompleted += new EventHandler(proxy_GetStreamedJobCompleted);
- proxy.StoreFinishedJobResultStreamedCompleted += new EventHandler(proxy_StoreFinishedJobResultStreamedCompleted);
- proxy.ProcessSnapshotStreamedCompleted += new EventHandler(proxy_ProcessSnapshotStreamedCompleted);
- proxy.ProcessHeartBeatCompleted += new EventHandler(proxy_ProcessHeartBeatCompleted);
- Logger.Debug("Registered new Events");
- Logger.Debug("Opening the Connection");
- proxy.ClientCredentials.UserName.UserName = Settings.Default.HiveUsername;
- proxy.ClientCredentials.UserName.Password = Settings.Default.HivePassword;
- proxy.Open();
- Logger.Debug("Opened the Connection");
-
ConnState = NetworkEnum.WcfConnState.Connected;
ConnectedSince = DateTime.Now;
- LoggedIn = false;
if (Connected != null) {
- Logger.Debug("Calling the connected Event");
Connected(this, new EventArgs());
- //Todo: This won't be hit. EVER
}
if (ConnState == NetworkEnum.WcfConnState.Failed) {
ConnectionRestored(this, new EventArgs());
}
- } catch (Exception ex) {
+ }
+ catch (Exception ex) {
HandleNetworkError(ex);
}
- }
-
- ///
- /// Changes the Connectionsettings (serverIP) and reconnects
- ///
- /// current Server IP
- public void Connect(String serverIP) {
- Logger.Debug("Called Connected with " + serverIP);
- String oldIp = this.ServerIP;
- this.ServerIP = serverIP;
- Connect();
- if (oldIp != serverIP)
- if (ServerChanged != null)
- ServerChanged(this, new EventArgs());
- }
-
- public void SetIP(String serverIP) {
- Logger.Debug("Called with " + serverIP);
- this.ServerIP = serverIP;
- }
-
- ///
- /// Disconnects the Slave from the Server
- ///
+ finally {
+ ServiceLocator.DisposeSlaveClient(client);
+ }
+ }
+
+ /////
+ ///// Disconnects the Slave from the Server
+ /////
public void Disconnect() {
ConnState = NetworkEnum.WcfConnState.Disconnected;
@@ -161,9 +141,11 @@
/// Methods for the Server Login
///
- public void LoginSync(SlaveDto slaveInfo) {
+ public void Login(SlaveDto slaveInfo) {
+ SlaveService.ISlaveFacade client = null;
try {
if (ConnState == NetworkEnum.WcfConnState.Connected) {
Logger.Debug("STARTED: Login Sync");
- Response res = proxy.Login(slaveInfo);
+ client = ServiceLocator.CreateSlaveFacade(ServerIp);
+ Response res = client.Login(slaveInfo);
if (res.StatusMessage != ResponseStatus.Ok) {
Logger.Error("FAILED: Login Failed! " + res.StatusMessage);
@@ -174,9 +156,13 @@
}
}
- } catch (Exception e) {
- HandleNetworkError(e);
- }
- }
-
+ }
+ catch (Exception e) {
+ HandleNetworkError(e);
+ }
+ finally {
+ ServiceLocator.DisposeSlaveClient(client);
+ }
+ }
+
///
/// Pull a Job from the Server
@@ -187,45 +173,48 @@
if (LoggedIn) {
Logger.Debug("STARTED: Fetching of Jobs from Server for Slave");
- proxy.GetStreamedJobAsync(guid);
- }
- }
-
- void proxy_GetStreamedJobCompleted(object sender, GetStreamedJobCompletedEventArgs e) {
- if (e.Error == null) {
- Logger.Debug("ENDED: Fetching of Jobs from Server for Slave");
- Stream stream = null;
- MemoryStream memStream = null;
-
- try {
- stream = (Stream)e.Result;
-
- //first deserialize the response
- BinaryFormatter formatter = new BinaryFormatter();
- ResponseObject response = (ResponseObject)formatter.Deserialize(stream);
-
- //second deserialize the BLOB
- memStream = new MemoryStream();
-
- byte[] buffer = new byte[3024];
- int read = 0;
- while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) {
- memStream.Write(buffer, 0, read);
- }
-
- memStream.Close();
-
- GetJobCompletedEventArgs completedEventArgs = new GetJobCompletedEventArgs(new object[] { response, memStream.GetBuffer() }, e.Error, e.Cancelled, e.UserState);
- GetJobCompleted(sender, completedEventArgs);
- } catch (Exception ex) {
- Logger.Error(ex);
- } finally {
- if (stream != null)
- stream.Dispose();
-
- if (memStream != null)
- memStream.Dispose();
- }
- } else
- HandleNetworkError(e.Error);
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ //client.GetStreamedJobAsync(guid);
+ client.BeginGetStreamedJob(guid, (ar => {
+ if (ar.IsCompleted) {
+ Stream stream = null;
+ MemoryStream memStream = null;
+ try {
+ Logger.Debug("ENDED: Fetching of Jobs from Server for Slave");
+ stream = client.EndGetStreamedJob(ar);
+
+ //first deserialize the response
+ BinaryFormatter formatter = new BinaryFormatter();
+ ResponseObject response = (ResponseObject)formatter.Deserialize(stream);
+
+ //second deserialize the BLOB
+ memStream = new MemoryStream();
+
+ byte[] buffer = new byte[3024];
+ int read = 0;
+ while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) {
+ memStream.Write(buffer, 0, read);
+ }
+
+ memStream.Close();
+
+ GetJobCompletedEventArgs completedEventArgs = new GetJobCompletedEventArgs(new object[] { response, memStream.GetBuffer() }, null, !ar.IsCompleted, ar.AsyncState);
+ GetJobCompleted(this, completedEventArgs);
+ }
+ catch (Exception ex) {
+ Logger.Error(ex);
+ }
+ finally {
+ if (stream != null)
+ stream.Dispose();
+
+ if (memStream != null)
+ memStream.Dispose();
+ }
+ } else
+ HandleNetworkError(new FaultException("GetJobAsync did not complete"));
+
+ ServiceLocator.DisposeSlaveClient(client);
+ }), null);
+ }
}
@@ -244,22 +233,22 @@
Logger.Debug("Builded stream");
Logger.Debug("Making the call");
- proxy.StoreFinishedJobResultStreamedAsync(stream, stream);
- }
- }
-
- private void proxy_StoreFinishedJobResultStreamedCompleted(object sender, StoreFinishedJobResultStreamedCompletedEventArgs e) {
- Logger.Debug("Finished storing the job");
- Stream stream = (Stream)e.UserState;
- if (stream != null) {
- Logger.Debug("Stream not null, disposing it");
- stream.Dispose();
- }
- if (e.Error == null) {
- StoreFinishedJobResultCompletedEventArgs args = new StoreFinishedJobResultCompletedEventArgs(new object[] { e.Result }, e.Error, e.Cancelled, e.UserState);
- Logger.Debug("calling the Finished Job Event");
- GetFinishedJobResultCompleted(sender, args);
- Logger.Debug("ENDED: Sending back the finished job results");
- } else {
- HandleNetworkError(e.Error);
+ //proxy.StoreFinishedJobResultStreamedAsync(stream, stream);
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ client.BeginStoreFinishedJobResultStreamed(stream, (ar => {
+ Logger.Debug("Finished storing the job");
+ if (stream != null)
+ stream.Dispose();
+
+ if (ar.IsCompleted) {
+ var res = client.EndStoreFinishedJobResultStreamed(ar);
+ StoreFinishedJobResultCompletedEventArgs args = new StoreFinishedJobResultCompletedEventArgs(new object[] { res }, null, false, null);
+ Logger.Debug("calling the Finished Job Event");
+ GetFinishedJobResultCompleted(this, args);
+ Logger.Debug("ENDED: Sending back the finished job results");
+ } else {
+ HandleNetworkError(new FaultException("GetFinishedJobResultAsync did not complete"));
+ }
+ ServiceLocator.DisposeSlaveClient(client);
+ }), null);
}
}
@@ -272,22 +261,20 @@
if (LoggedIn) {
Stream stream = GetStreamedJobResult(clientId, jobId, result, percentage, exception);
- proxy.ProcessSnapshotStreamedAsync(stream, stream);
- }
- }
-
- void proxy_ProcessSnapshotStreamedCompleted(object sender, ProcessSnapshotStreamedCompletedEventArgs e) {
- Stream stream =
- (Stream)e.UserState;
- if (stream != null)
- stream.Dispose();
-
- if (e.Error == null) {
- ProcessSnapshotCompletedEventArgs args =
- new ProcessSnapshotCompletedEventArgs(
- new object[] { e.Result }, e.Error, e.Cancelled, e.UserState);
-
- ProcessSnapshotCompleted(sender, args);
- } else
- HandleNetworkError(e.Error);
+ //proxy.ProcessSnapshotStreamedAsync(stream, stream);
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ client.BeginProcessSnapshotStreamed(stream, (ar => {
+ if (stream != null)
+ stream.Dispose();
+
+ if (ar.IsCompleted) {
+ var res = client.EndStoreFinishedJobResultStreamed(ar);
+ ProcessSnapshotCompletedEventArgs args = new ProcessSnapshotCompletedEventArgs(new object[] { res }, null, false, null);
+ ProcessSnapshotCompleted(this, args);
+ } else {
+ HandleNetworkError(new FaultException("ProcessSnapshotAsync did not complete"));
+ }
+ ServiceLocator.DisposeSlaveClient(client);
+ }), null);
+ }
}
@@ -301,20 +288,22 @@
public event System.EventHandler ProcessHeartBeatCompleted;
public void ProcessHeartBeatAsync(HeartBeatData hbd) {
- if (LoggedIn)
+ if (LoggedIn) {
Logger.Debug("STARTING: sending heartbeat");
- proxy.ProcessHeartBeatAsync(hbd);
- }
-
- private void proxy_ProcessHeartBeatCompleted(object sender, ProcessHeartBeatCompletedEventArgs e) {
- if (e.Error == null && e.Result.StatusMessage == ResponseStatus.Ok) {
- ProcessHeartBeatCompleted(sender, e);
- Logger.Debug("ENDED: sending heartbeats");
- } else {
- try {
- Logger.Error("Error: " + e.Result.StatusMessage);
- } catch (Exception ex) {
- Logger.Error("Error: ", ex);
- }
- HandleNetworkError(e.Error);
+ //proxy.ProcessHeartBeatAsync(hbd);
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ client.BeginProcessHeartBeat(hbd, (ar => {
+ if (ar.IsCompleted) {
+ var res = client.EndProcessHeartBeat(ar);
+ if (res.StatusMessage == ResponseStatus.Ok) {
+ ProcessHeartBeatCompleted(this, new ProcessHeartBeatCompletedEventArgs(new object[] { res }, null, false, null));
+ Logger.Debug("ENDED: sending heartbeats");
+ } else {
+ Logger.Error("FAILED: sending heartbeats: " + res.StatusMessage.ToString());
+ }
+ } else {
+ HandleNetworkError(new FaultException("ProcessHeartBeatAsync did not complete"));
+ }
+ ServiceLocator.DisposeSlaveClient(client);
+ }), null);
}
}
@@ -345,5 +334,8 @@
public ResponseResultReceived StoreFinishedJobResultsSync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception, bool finished) {
- return proxy.StoreFinishedJobResultStreamed(GetStreamedJobResult(clientId, jobId, result, percentage, exception));
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ ResponseResultReceived res = client.StoreFinishedJobResultStreamed(GetStreamedJobResult(clientId, jobId, result, percentage, exception));
+ ServiceLocator.DisposeSlaveClient(client);
+ return res;
}
@@ -351,8 +343,11 @@
try {
Logger.Debug("STARTING: Sync call: IsJobStillNeeded");
- Response res = proxy.IsJobStillNeeded(jobId);
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ Response res = client.IsJobStillNeeded(jobId);
+ ServiceLocator.DisposeSlaveClient(client);
Logger.Debug("ENDED: Sync call: IsJobStillNeeded");
return res;
- } catch (Exception e) {
+ }
+ catch (Exception e) {
HandleNetworkError(e);
return null;
@@ -362,6 +357,10 @@
public ResponseResultReceived ProcessSnapshotSync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception) {
try {
- return proxy.ProcessSnapshotStreamed(GetStreamedJobResult(clientId, jobId, result, percentage, exception));
- } catch (Exception e) {
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ var res = client.ProcessSnapshotStreamed(GetStreamedJobResult(clientId, jobId, result, percentage, exception));
+ ServiceLocator.DisposeSlaveClient(client);
+ return res;
+ }
+ catch (Exception e) {
HandleNetworkError(e);
return null;
@@ -373,5 +372,7 @@
Logger.Debug("STARTED: Requesting Plugins for Job");
Logger.Debug("STARTED: Getting the stream");
- Stream stream = proxy.GetStreamedPlugins(requestedPlugins.ToArray());
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ Stream stream = client.GetStreamedPlugins(requestedPlugins.ToArray());
+ ServiceLocator.DisposeSlaveClient(client);
Logger.Debug("ENDED: Getting the stream");
BinaryFormatter formatter = new BinaryFormatter();
@@ -382,5 +383,6 @@
stream.Dispose();
return response.List;
- } catch (Exception e) {
+ }
+ catch (Exception e) {
HandleNetworkError(e);
return null;
@@ -391,7 +393,10 @@
try {
Logger.Debug("STARTED: Logout");
- proxy.Logout(guid);
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ client.Logout(guid);
+ ServiceLocator.DisposeSlaveClient(client);
Logger.Debug("ENDED: Logout");
- } catch (Exception e) {
+ }
+ catch (Exception e) {
HandleNetworkError(e);
}
@@ -401,8 +406,11 @@
try {
Logger.Debug("STARTED: Syncing Calendars");
- ResponseCalendar cal = proxy.GetCalendar(clientId);
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ ResponseCalendar cal = client.GetCalendar(clientId);
+ ServiceLocator.DisposeSlaveClient(client);
Logger.Debug("ENDED: Syncing Calendars");
return cal;
- } catch (Exception e) {
+ }
+ catch (Exception e) {
HandleNetworkError(e);
return null;
@@ -413,8 +421,11 @@
try {
Logger.Debug("STARTED: Setting Calendar status to: " + state);
- Response resp = proxy.SetCalendarStatus(clientId, state);
+ SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);
+ Response resp = client.SetCalendarStatus(clientId, state);
+ ServiceLocator.DisposeSlaveClient(client);
Logger.Debug("ENDED: Setting Calendar status to: " + state);
return resp;
- } catch (Exception e) {
+ }
+ catch (Exception e) {
HandleNetworkError(e);
return null;
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/app.config
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/app.config (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/app.config (revision 4337)
@@ -24,5 +24,5 @@
transactionFlow="false" transferMode="Streamed" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="104857600"
- maxBufferSize="104857600" maxConnections="100" listenBacklog="100" maxReceivedMessageSize="104857600">
+ maxBufferSize="104857600" maxReceivedMessageSize="104857600">
@@ -38,5 +38,5 @@
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
- maxBufferSize="65536" maxConnections="100" listenBacklog="100" maxReceivedMessageSize="65536">
+ maxBufferSize="65536" maxReceivedMessageSize="65536">
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Console/3.3/app.config
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Console/3.3/app.config (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Console/3.3/app.config (revision 4337)
@@ -19,6 +19,6 @@
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
- hostNameComparisonMode="StrongWildcard" listenBacklog="100" maxBufferPoolSize="524288"
- maxBufferSize="65536" maxConnections="100" maxReceivedMessageSize="65536">
+ hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
+ maxBufferSize="65536" maxReceivedMessageSize="65536">
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/Core.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/Core.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/Core.cs (revision 4337)
@@ -89,5 +89,5 @@
ConnectionContainer cc = ConfigManager.Instance.GetServerIP();
if (cc.IPAdress != String.Empty) {
- wcfService.SetIP(cc.IPAdress);
+ wcfService.ServerIp = cc.IPAdress;
}
}
@@ -112,5 +112,5 @@
wcfService.ProcessSnapshotCompleted += new EventHandler(wcfService_ProcessSnapshotCompleted);
wcfService.ConnectionRestored += new EventHandler(wcfService_ConnectionRestored);
- wcfService.ServerChanged += new EventHandler(wcfService_ServerChanged);
+ //wcfService.ServerChanged += new EventHandler(wcfService_ServerChanged);
wcfService.Connected += new EventHandler(wcfService_Connected);
}
@@ -121,5 +121,5 @@
wcfService.ProcessSnapshotCompleted -= new EventHandler(wcfService_ProcessSnapshotCompleted);
wcfService.ConnectionRestored -= new EventHandler(wcfService_ConnectionRestored);
- wcfService.ServerChanged -= new EventHandler(wcfService_ServerChanged);
+ //wcfService.ServerChanged -= new EventHandler(wcfService_ServerChanged);
wcfService.Connected -= new EventHandler(wcfService_Connected);
}
@@ -244,5 +244,5 @@
} else {
Logger.Info("Storing the finished job with id: " + jId + " to hdd");
- JobStorageManager.PersistObjectToDisc(wcfService.ServerIP, 0, jId, sJob); // [chn] Port is not unique anymore (since we need two ports for http and net.tcp-streaming). also the port is now specified only in app.config. use port 0 for the moment
+ JobStorageManager.PersistObjectToDisc(wcfService.ServerIp, 0, jId, sJob); // [chn] Port is not unique anymore (since we need two ports for http and net.tcp-streaming). also the port is now specified only in app.config. use port 0 for the moment
KillAppDomain(jId);
}
@@ -382,22 +382,4 @@
}
- ///
- /// The server has been changed. All Appdomains and Jobs must be aborted!
- ///
- ///
- ///
- void wcfService_ServerChanged(object sender, EventArgs e) {
- Logger.Info("ServerChanged has been called");
- lock (engines) {
- foreach (KeyValuePair entries in engines) {
- engines[entries.Key].Abort();
- //appDomains[entries.Key].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException);
- //AppDomain.Unload(appDomains[entries.Key]);
- }
- //appDomains = new Dictionary();
- //engines = new Dictionary();
- //jobs = new Dictionary();
- }
- }
///
@@ -417,8 +399,7 @@
Logger.Info("CalendarAvailable is " + UptimeManager.Instance.CalendarAvailable + " and IsOnline is: " + UptimeManager.Instance.IsAllowedToCalculate());
Logger.Info("Setting client online");
- wcfService.LoginSync(ConfigManager.Instance.GetClientInfo());
+ wcfService.Login(ConfigManager.Instance.GetClientInfo());
JobStorageManager.CheckAndSubmitJobsFromDisc();
CurrentlyFetching = false;
- //}
}
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/HeartbeatManager.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/HeartbeatManager.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/HeartbeatManager.cs (revision 4337)
@@ -84,5 +84,5 @@
}
if (!wcfService.LoggedIn) {
- wcfService.LoginSync(ConfigManager.Instance.GetClientInfo()); // if login faild previously try again
+ wcfService.Login(ConfigManager.Instance.GetClientInfo()); // if login faild previously try again
}
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/JobStorage/JobStorageManager.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/JobStorage/JobStorageManager.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/JobStorage/JobStorageManager.cs (revision 4337)
@@ -45,5 +45,5 @@
public static void CheckAndSubmitJobsFromDisc() {
for (int index = storedJobsList.Count; index > 0; index--) {
- if (WcfService.Instance.LoggedIn && (storedJobsList[index - 1].ServerIP == WcfService.Instance.ServerIP)) {
+ if (WcfService.Instance.LoggedIn && (storedJobsList[index - 1].ServerIP == WcfService.Instance.ServerIp)) {
String filename = storedJobsList[index - 1].ServerIP + "." + storedJobsList[index - 1].ServerPort + "." + storedJobsList[index - 1].JobID.ToString();
Logger.Info("Sending stored job " + storedJobsList[index - 1].JobID + " to the server");
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/SlaveConsoleService/Interfaces/ISlaveConsoleCommunicator.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/SlaveConsoleService/Interfaces/ISlaveConsoleCommunicator.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/SlaveConsoleService/Interfaces/ISlaveConsoleCommunicator.cs (revision 4337)
@@ -48,6 +48,6 @@
/// Signals the client to disconnect from the server
///
- [OperationContract]
- void Disconnect();
+ //[OperationContract]
+ //void Disconnect();
///
/// Get the current connection details
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/SlaveConsoleService/SlaveConsoleCommunicator.cs
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/SlaveConsoleService/SlaveConsoleCommunicator.cs (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/SlaveConsoleService/SlaveConsoleCommunicator.cs (revision 4337)
@@ -20,13 +20,14 @@
public void SetConnection(ConnectionContainer container) {
ConfigManager.Instance.SetServerIP(container);
- WcfService.Instance.Connect(container.IPAdress);
+ //WcfService.Instance.Connect(container.IPAdress);
+ WcfService.Instance.ServerIp = container.IPAdress;
}
- public void Disconnect() {
- WcfService.Instance.Disconnect();
- }
+ //public void Disconnect() {
+ // WcfService.Instance.Disconnect();
+ //}
public ConnectionContainer GetCurrentConnection() {
- return new ConnectionContainer { IPAdress = WcfService.Instance.ServerIP };
+ return new ConnectionContainer { IPAdress = WcfService.Instance.ServerIp };
}
Index: /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/app.config
===================================================================
--- /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/app.config (revision 4336)
+++ /branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/app.config (revision 4337)
@@ -26,5 +26,5 @@
-
+