Changeset 923 for trunk/sources/HeuristicLab.Hive.Client.Core
- Timestamp:
- 12/07/08 16:14:00 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Client.Core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs
r919 r923 50 50 Dictionary<long, AppDomain> appDomains = new Dictionary<long, AppDomain>(); 51 51 52 private ClientCommunicatorClient clientCommunicator;52 private WcfService wcfService; 53 53 54 54 public void Start() { … … 60 60 manager.Core = this; 61 61 62 clientCommunicator = ServiceLocator.GetClientCommunicator(); 63 clientCommunicator.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(ClientCommunicator_LoginCompleted); 64 clientCommunicator.PullJobCompleted += new EventHandler<PullJobCompletedEventArgs>(ClientCommunicator_PullJobCompleted); 65 clientCommunicator.SendJobResultCompleted += new EventHandler<SendJobResultCompletedEventArgs>(ClientCommunicator_SendJobResultCompleted); 66 //clientCommunicator.LoginAsync(ConfigurationManager.GetInstance().GetClientInfo()); 62 wcfService = WcfService.Instance; 63 wcfService.Connect("192.168.132.1", "9000"); 64 65 wcfService.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(wcfService_LoginCompleted); 66 wcfService.PullJobCompleted += new EventHandler<PullJobCompletedEventArgs>(wcfService_PullJobCompleted); 67 wcfService.SendJobResultCompleted += new EventHandler<SendJobResultCompletedEventArgs>(wcfService_SendJobResultCompleted); 68 69 wcfService.LoginAsync(ConfigurationManager.GetInstance().GetClientInfo()); 67 70 68 71 Heartbeat beat = new Heartbeat { Interval = 10000 }; … … 76 79 DetermineAction(container); 77 80 } 78 }79 80 void ClientCommunicator_LoginCompleted(object sender, LoginCompletedEventArgs e) {81 if (e.Result.Success) {82 Logging.GetInstance().Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now);83 ConfigurationManager.GetInstance().Loggedin();84 Status.LoginTime = DateTime.Now;85 Status.LoggedIn = true;86 } else87 Logging.GetInstance().Error(this.ToString(), e.Result.StatusMessage);88 81 } 89 82 … … 106 99 107 100 case MessageContainer.MessageType.FetchJob: 108 clientCommunicator.PullJobAsync(Guid.NewGuid());101 wcfService.PullJobAsync(Guid.NewGuid()); 109 102 break; 110 103 case MessageContainer.MessageType.FinishedJob: … … 115 108 } 116 109 110 #region Async Threads for the EE 111 117 112 private void GetFinishedJob(object jobId) { 118 113 long jId = (long)jobId; … … 120 115 121 116 JobResult jobResult = new JobResult { JobId = jId, Result = sJob, Client = ConfigurationManager.GetInstance().GetClientInfo() }; 122 clientCommunicator.SendJobResultAsync(jobResult, true);117 wcfService.SendJobResultAsync(jobResult, true); 123 118 } 124 119 … … 128 123 } 129 124 130 void ClientCommunicator_PullJobCompleted(object sender, PullJobCompletedEventArgs e) { 125 #endregion 126 127 #region wcfService Events 128 129 void wcfService_LoginCompleted(object sender, LoginCompletedEventArgs e) { 130 if (e.Result.Success) { 131 Logging.GetInstance().Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now); 132 ConfigurationManager.GetInstance().Loggedin(); 133 Status.LoginTime = DateTime.Now; 134 Status.LoggedIn = true; 135 } else 136 Logging.GetInstance().Error(this.ToString(), e.Result.StatusMessage); 137 } 138 139 void wcfService_PullJobCompleted(object sender, PullJobCompletedEventArgs e) { 131 140 bool sandboxed = false; 132 141 … … 147 156 } 148 157 149 void ClientCommunicator_SendJobResultCompleted(object sender, SendJobResultCompletedEventArgs e) {158 void wcfService_SendJobResultCompleted(object sender, SendJobResultCompletedEventArgs e) { 150 159 if (e.Result.Success) { 151 160 AppDomain.Unload(appDomains[e.Result.JobId]); … … 159 168 } 160 169 170 #endregion 171 161 172 public Dictionary<long, Executor> GetExecutionEngines() { 162 173 return engines; -
trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs
r798 r923 48 48 } 49 49 50 private ClientCommunicatorClient clientCommunicator;50 private WcfService wcfService; 51 51 52 52 /// <summary> … … 58 58 heartbeatTimer.AutoReset = true; 59 59 heartbeatTimer.Elapsed += new ElapsedEventHandler(heartbeatTimer_Elapsed); 60 clientCommunicator = ServiceLocator.GetClientCommunicator();61 clientCommunicator.SendHeartBeatCompleted += new EventHandler<SendHeartBeatCompletedEventArgs>(ClientCommunicator_SendHeartBeatCompleted);60 wcfService = WcfService.Instance; 61 wcfService.SendHeartBeatCompleted += new EventHandler<SendHeartBeatCompletedEventArgs>(wcfService_SendHeartBeatCompleted); 62 62 heartbeatTimer.Start(); 63 63 } … … 74 74 freeMemory = 1000, 75 75 jobProgress = 1}; 76 clientCommunicator.SendHeartBeatAsync(heartBeatData); 76 if (wcfService.ConnState == WcfService.ConnectionState.failed) { 77 wcfService.Connect(); 78 } else if (wcfService.ConnState == WcfService.ConnectionState.connected) { 79 wcfService.SendHeartBeatAsync(heartBeatData); 80 } 77 81 } 78 82 79 void ClientCommunicator_SendHeartBeatCompleted(object sender, SendHeartBeatCompletedEventArgs e) {83 void wcfService_SendHeartBeatCompleted(object sender, SendHeartBeatCompletedEventArgs e) { 80 84 System.Diagnostics.Debug.WriteLine("Heartbeat received! "); 81 85 e.Result.ActionRequest.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc));
Note: See TracChangeset
for help on using the changeset viewer.