Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/10 09:17:24 (14 years ago)
Author:
kgrading
Message:

added minor speedups and better transaction handling to the server (#828)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/sources/HeuristicLab.Hive.Server/3.2/ServiceCallInterception.cs

    r3578 r3931  
    1616
    1717    public object Invoke(IMethodInvocation invocation) {
     18      DateTime start = DateTime.Now;
    1819      Logger.Info("Entering Method: " + invocation.Method.Name);
    1920
    20       if(ContextFactory.Context != null) {
     21      if(!ContextFactory.IsContextNull()) {
    2122        Logger.Info("Not null context found - why wasn't this disposed?");
    2223        try {
     
    2829        ContextFactory.Context = null;
    2930      }
    30 
     31      Logger.Info("Context info: Timeout: " + ContextFactory.Context.Connection.ConnectionTimeout + " | " +
     32                  ContextFactory.Context.Connection.State + " | Conn: " + ContextFactory.Context + " | HashCode is: " + ContextFactory.Context.Connection.GetHashCode());
    3133      Object obj = null;
    3234
    33       if (invocation.Method.Name.Equals("SendStreamedJob") || invocation.Method.Name.Equals("StoreFinishedJobResultStreamed")) {       
     35      /*if (invocation.Method.Name.Equals("SendStreamedJob") || invocation.Method.Name.Equals("StoreFinishedJobResultStreamed")) {       
    3436        ContextFactory.Context.Connection.Open();
    3537        if(UseTransactions) {
     
    4850          ContextFactory.Context = null;
    4951        }       
    50       } else {
     52      } else { */
    5153        if(UseTransactions) {
    5254          using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) {
     
    5759            }
    5860            catch (Exception e) {
    59               Logger.Error("Exception occured during method invocation", e);             
     61              Logger.Error("Exception occured during method invocation", e);     
     62              Logger.Error("Inner Exception: ", e.InnerException);
    6063            }
    6164            finally {
     
    8083          } 
    8184        }
     85      //}       
     86      TimeSpan ts = DateTime.Now - start;
     87      if (ts.Seconds > 2) {
     88        Logger.Warn("Invocation took: " + ts);
     89      } else if (ts.Seconds > 10) {
     90        Logger.Error("Invocation took: " + ts);
     91      } else {
     92        Logger.Info("Invocation took: " + ts); ;
    8293      }
    8394      Logger.Info("Leaving Method: " + invocation.Method.Name);
    84 
     95     
    8596      return obj;
    8697    }
Note: See TracChangeset for help on using the changeset viewer.