Changeset 4338 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/WcfService.cs
- Timestamp:
- 08/27/10 13:25:48 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/WcfService.cs
r4337 r4338 78 78 public event EventHandler Connected; 79 79 80 SlaveFacadeServicePool servicePool; 81 80 82 /// <summary> 81 83 /// Constructor … … 97 99 return; 98 100 } 101 servicePool = new SlaveFacadeServicePool(ServerIp); 99 102 100 103 Logger.Debug("Creating the new connection proxy"); 101 client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);104 client = servicePool.CreateStreamedSlaveFacade(); 102 105 Logger.Debug("Created the new connection proxy"); 103 106 … … 116 119 } 117 120 finally { 118 ServiceLocator.DisposeSlaveClient(client);121 servicePool.DisposeSlaveClient(client); 119 122 } 120 123 } … … 146 149 if (ConnState == NetworkEnum.WcfConnState.Connected) { 147 150 Logger.Debug("STARTED: Login Sync"); 148 client = ServiceLocator.CreateSlaveFacade(ServerIp);151 client = servicePool.CreateSlaveFacade(); 149 152 Response res = client.Login(slaveInfo); 150 153 if (res.StatusMessage != ResponseStatus.Ok) { … … 161 164 } 162 165 finally { 163 ServiceLocator.DisposeSlaveClient(client);166 servicePool.DisposeSlaveClient(client); 164 167 } 165 168 } … … 173 176 if (LoggedIn) { 174 177 Logger.Debug("STARTED: Fetching of Jobs from Server for Slave"); 175 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);178 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 176 179 //client.GetStreamedJobAsync(guid); 177 180 client.BeginGetStreamedJob(guid, (ar => { … … 214 217 HandleNetworkError(new FaultException("GetJobAsync did not complete")); 215 218 216 ServiceLocator.DisposeSlaveClient(client);219 servicePool.DisposeSlaveClient(client); 217 220 }), null); 218 221 } … … 234 237 Logger.Debug("Making the call"); 235 238 //proxy.StoreFinishedJobResultStreamedAsync(stream, stream); 236 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);239 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 237 240 client.BeginStoreFinishedJobResultStreamed(stream, (ar => { 238 241 Logger.Debug("Finished storing the job"); … … 249 252 HandleNetworkError(new FaultException("GetFinishedJobResultAsync did not complete")); 250 253 } 251 ServiceLocator.DisposeSlaveClient(client);254 servicePool.DisposeSlaveClient(client); 252 255 }), null); 253 256 } … … 262 265 Stream stream = GetStreamedJobResult(clientId, jobId, result, percentage, exception); 263 266 //proxy.ProcessSnapshotStreamedAsync(stream, stream); 264 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);267 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 265 268 client.BeginProcessSnapshotStreamed(stream, (ar => { 266 269 if (stream != null) … … 274 277 HandleNetworkError(new FaultException("ProcessSnapshotAsync did not complete")); 275 278 } 276 ServiceLocator.DisposeSlaveClient(client);279 servicePool.DisposeSlaveClient(client); 277 280 }), null); 278 281 } … … 291 294 Logger.Debug("STARTING: sending heartbeat"); 292 295 //proxy.ProcessHeartBeatAsync(hbd); 293 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);296 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 294 297 client.BeginProcessHeartBeat(hbd, (ar => { 295 298 if (ar.IsCompleted) { … … 304 307 HandleNetworkError(new FaultException("ProcessHeartBeatAsync did not complete")); 305 308 } 306 ServiceLocator.DisposeSlaveClient(client);309 servicePool.DisposeSlaveClient(client); 307 310 }), null); 308 311 } … … 334 337 335 338 public ResponseResultReceived StoreFinishedJobResultsSync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception, bool finished) { 336 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);339 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 337 340 ResponseResultReceived res = client.StoreFinishedJobResultStreamed(GetStreamedJobResult(clientId, jobId, result, percentage, exception)); 338 ServiceLocator.DisposeSlaveClient(client);341 servicePool.DisposeSlaveClient(client); 339 342 return res; 340 343 } … … 343 346 try { 344 347 Logger.Debug("STARTING: Sync call: IsJobStillNeeded"); 345 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);348 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 346 349 Response res = client.IsJobStillNeeded(jobId); 347 ServiceLocator.DisposeSlaveClient(client);350 servicePool.DisposeSlaveClient(client); 348 351 Logger.Debug("ENDED: Sync call: IsJobStillNeeded"); 349 352 return res; … … 357 360 public ResponseResultReceived ProcessSnapshotSync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception) { 358 361 try { 359 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);362 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 360 363 var res = client.ProcessSnapshotStreamed(GetStreamedJobResult(clientId, jobId, result, percentage, exception)); 361 ServiceLocator.DisposeSlaveClient(client);364 servicePool.DisposeSlaveClient(client); 362 365 return res; 363 366 } … … 372 375 Logger.Debug("STARTED: Requesting Plugins for Job"); 373 376 Logger.Debug("STARTED: Getting the stream"); 374 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);377 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 375 378 Stream stream = client.GetStreamedPlugins(requestedPlugins.ToArray()); 376 ServiceLocator.DisposeSlaveClient(client);379 servicePool.DisposeSlaveClient(client); 377 380 Logger.Debug("ENDED: Getting the stream"); 378 381 BinaryFormatter formatter = new BinaryFormatter(); … … 393 396 try { 394 397 Logger.Debug("STARTED: Logout"); 395 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);398 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 396 399 client.Logout(guid); 397 ServiceLocator.DisposeSlaveClient(client);400 servicePool.DisposeSlaveClient(client); 398 401 Logger.Debug("ENDED: Logout"); 399 402 } … … 406 409 try { 407 410 Logger.Debug("STARTED: Syncing Calendars"); 408 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);411 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 409 412 ResponseCalendar cal = client.GetCalendar(clientId); 410 ServiceLocator.DisposeSlaveClient(client);413 servicePool.DisposeSlaveClient(client); 411 414 Logger.Debug("ENDED: Syncing Calendars"); 412 415 return cal; … … 421 424 try { 422 425 Logger.Debug("STARTED: Setting Calendar status to: " + state); 423 SlaveService.ISlaveFacade client = ServiceLocator.CreateStreamedSlaveFacade(ServerIp);426 SlaveService.ISlaveFacade client = servicePool.CreateStreamedSlaveFacade(); 424 427 Response resp = client.SetCalendarStatus(clientId, state); 425 ServiceLocator.DisposeSlaveClient(client);428 servicePool.DisposeSlaveClient(client); 426 429 Logger.Debug("ENDED: Setting Calendar status to: " + state); 427 430 return resp;
Note: See TracChangeset
for help on using the changeset viewer.