Changeset 1490
- Timestamp:
- 04/02/09 15:26:11 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r1478 r1490 78 78 void lifecycleManager_OnServerHeartbeat(object sender, EventArgs e) { 79 79 ISession session = factory.GetSessionForCurrentThread(); 80 ITransaction tx = null; 80 81 81 82 try { … … 84 85 IJobAdapter jobAdapter = 85 86 session.GetDataAdapter<Job, IJobAdapter>(); 87 88 tx = session.BeginTransaction(); 86 89 87 90 List<ClientInfo> allClients = new List<ClientInfo>(clientAdapter.GetAll()); … … 126 129 } 127 130 } 131 tx.Commit(); 132 } 133 catch (Exception ex) { 134 if (tx != null) 135 tx.Rollback(); 136 throw ex; 128 137 } 129 138 finally { … … 143 152 public Response Login(ClientInfo clientInfo) { 144 153 ISession session = factory.GetSessionForCurrentThread(); 154 ITransaction tx = null; 145 155 146 156 try { 147 157 IClientAdapter clientAdapter = 148 158 session.GetDataAdapter<ClientInfo, IClientAdapter>(); 159 160 tx = session.BeginTransaction(); 149 161 150 162 Response response = new Response(); … … 169 181 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGIN_SUCCESS; 170 182 183 tx.Commit(); 171 184 return response; 185 } 186 catch (Exception ex) { 187 if (tx != null) 188 tx.Rollback(); 189 throw ex; 172 190 } 173 191 finally { … … 186 204 public ResponseHB ProcessHeartBeat(HeartBeatData hbData) { 187 205 ISession session = factory.GetSessionForCurrentThread(); 206 ITransaction tx = null; 188 207 189 208 try { … … 193 212 IJobAdapter jobAdapter = 194 213 session.GetDataAdapter<Job, IJobAdapter>(); 214 215 tx = session.BeginTransaction(); 195 216 196 217 ResponseHB response = new ResponseHB(); … … 248 269 } 249 270 } 250 271 tx.Commit(); 251 272 return response; 273 } 274 catch (Exception ex) { 275 if (tx != null) 276 tx.Rollback(); 277 throw ex; 252 278 } 253 279 finally { … … 286 312 bool finished) { 287 313 ISession session = factory.GetSessionForCurrentThread(); 314 ITransaction tx = null; 288 315 289 316 try { … … 294 321 IJobResultsAdapter jobResultAdapter = 295 322 session.GetDataAdapter<JobResult, IJobResultsAdapter>(); 323 324 tx = session.BeginTransaction(); 296 325 297 326 ResponseResultReceived response = new ResponseResultReceived(); … … 359 388 response.finished = finished; 360 389 390 tx.Commit(); 361 391 return response; 392 } 393 catch (Exception ex) { 394 if (tx != null) 395 tx.Rollback(); 396 throw ex; 362 397 } 363 398 finally { … … 401 436 public Response Logout(Guid clientId) { 402 437 ISession session = factory.GetSessionForCurrentThread(); 438 ITransaction tx = null; 403 439 404 440 try { … … 407 443 IJobAdapter jobAdapter = 408 444 session.GetDataAdapter<Job, IJobAdapter>(); 445 446 tx = session.BeginTransaction(); 409 447 410 448 Response response = new Response(); … … 437 475 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGOUT_SUCCESS; 438 476 477 tx.Commit(); 439 478 return response; 479 } 480 catch (Exception ex) { 481 if (tx != null) 482 tx.Rollback(); 483 throw ex; 440 484 } 441 485 finally { … … 453 497 public Response IsJobStillNeeded(Guid jobId) { 454 498 ISession session = factory.GetSessionForCurrentThread(); 499 ITransaction tx = null; 455 500 456 501 try { 457 502 IJobAdapter jobAdapter = 458 503 session.GetDataAdapter<Job, IJobAdapter>(); 504 tx = session.BeginTransaction(); 459 505 460 506 Response response = new Response(); … … 475 521 response.Success = true; 476 522 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_SEND_JOBRESULT; 523 tx.Commit(); 477 524 return response; 525 } 526 catch (Exception ex) { 527 if (tx != null) 528 tx.Rollback(); 529 throw ex; 478 530 } 479 531 finally {
Note: See TracChangeset
for help on using the changeset viewer.