Ignore:
Timestamp:
Jan 26, 2011, 5:45:02 AM (13 years ago)
Author:
Sam Habiel
Message:

BMX version bumped to 2.3.
New dll
BMXNetConnectInfo: Event polling from RPMS/VISTA is now async. BMX Writer lock removed.
BMXNetLib:

  1. Application context changes are now suppressed. Developer must make sure that his/her application has all the needed BMX methods. This was done for performance enhancement as application context changes are very expensive in network time.
  2. Locks are implemented at the TransmitRPC with a very simple Lock(this) which works very well.

RPMSDb: See #1 for BMXNetLib. All context changes are now suppressed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/BMXNetLib.cs

    r1063 r1082  
    10271027                        try
    10281028                        {
    1029                                 string sContext = this.AppContext;
    1030                                 this.AppContext = "BMXRPC";
     1029                /* 3110109 -- smh Commented out for performance issues.
     1030                                /*string sContext = this.AppContext;
     1031                                this.AppContext = "BMXRPC";*/
    10311032                                Variable = Variable.Replace("^","~");
    10321033                                string sRet = "0";
     
    10351036                                sRet = TransmitRPC("BMX LOCK", sParam);
    10361037                                bRet = (sRet == "1")?true:false;
    1037                                 this.AppContext = sContext;
     1038                /* 3110109 -- smh Commented out for performance issues.
     1039                                /*this.AppContext = sContext;*/
    10381040                                return bRet;
    10391041                        }
     
    10771079                public string TransmitRPC(string sRPC, string sParam, int nLockTimeOut)
    10781080                {
    1079                         try
    1080                         {
    1081                                 try
    1082                                 {
    1083                                         if (m_bConnected == false)
    1084                                         {
    1085                                                 throw new BMXNetException("BMXNetLib.TransmitRPC failed because BMXNetLib is not connected to RPMS.");
    1086                                         }
    1087                                         Debug.Assert(m_cDUZ != "");
    1088                                         Debug.Assert(m_pCommSocket != null);
    1089 
    1090                                         string sOldAppContext = "";
    1091                                         if (sRPC.StartsWith("BMX")&&(this.m_cAppContext != "BMXRPC"))
    1092                                         {
    1093                                                 sOldAppContext  = this.m_cAppContext;
    1094                                                 this.AppContext = "BMXRPC";
    1095                                         }
    1096                                         string sMult = "";
    1097                                         string sSend = ADEBLDMsg(m_cHDR, sRPC, sParam, ref sMult);
    1098                                         SendString(m_pCommSocket, sSend, sMult);
    1099 #if TRACE   
    1100                     DateTime sendTime = DateTime.Now;
    1101                     Debug.Write("TransmitRPC Sent: " + sSend.Replace((char) 30, (char) 10) + "\n");
     1081            lock (this)  // This method CANNOT be executed simultaneously!
     1082            {
     1083                try
     1084                {
     1085                    try
     1086                    {
     1087                        if (m_bConnected == false)
     1088                        {
     1089                            throw new BMXNetException("BMXNetLib.TransmitRPC failed because BMXNetLib is not connected to RPMS.");
     1090                        }
     1091                        Debug.Assert(m_cDUZ != "");
     1092                        Debug.Assert(m_pCommSocket != null);
     1093
     1094                        string sOldAppContext = "";
     1095                        /* 3110109 -- smh Commented out for performance issues.
     1096                         if (sRPC.StartsWith("BMX")&&(this.m_cAppContext != "BMXRPC"))
     1097                        {
     1098                            sOldAppContext  = this.m_cAppContext;
     1099                            this.AppContext = "BMXRPC";
     1100                        }
     1101                         */
     1102                        string sMult = "";
     1103                        string sSend = ADEBLDMsg(m_cHDR, sRPC, sParam, ref sMult);
     1104                        SendString(m_pCommSocket, sSend, sMult);
     1105#if TRACE
     1106                        DateTime sendTime = DateTime.Now;
     1107                        int threadid = Thread.CurrentThread.ManagedThreadId;
     1108                        Debug.Write("TransmitRPC Sent: (T:" + threadid + ")" + sSend.Replace((char)30, (char)10) + "\n");
    11021109#endif
    1103                     string strResult = ReceiveString(m_pCommSocket);
     1110                        string strResult = ReceiveString(m_pCommSocket);
    11041111#if TRACE
    1105                     DateTime receiveTime = DateTime.Now;
    1106                     Debug.Write("TransmitRPC Received: " + strResult.Replace((char) 30, (char) 10) + "\n");
    1107                     TimeSpan executionTime = receiveTime - sendTime;
    1108                     Debug.Write("Execution Time: " + executionTime.TotalMilliseconds + " ms.\n");
    1109                     Debug.Write("-------------------------------------------------------\n");
     1112                        DateTime receiveTime = DateTime.Now;
     1113                        Debug.Write("TransmitRPC Received: (T:" + threadid + ")" + strResult.Replace((char)30, (char)10) + "\n");
     1114                        TimeSpan executionTime = receiveTime - sendTime;
     1115                        Debug.Write("Execution Time: " + executionTime.TotalMilliseconds + " ms.\n");
     1116                        Debug.Write("-------------------------------------------------------\n");
    11101117#endif
    1111                                         if (sOldAppContext != "")
     1118                        /* /* 3110109 -- smh Commented out for performance issues.
     1119                     * if (sOldAppContext != "")
    11121120                                        {
    11131121                                                this.AppContext = sOldAppContext;
    11141122                                        }
    1115                                         return strResult;                               
    1116                                 }
    1117                                 catch (Exception ex)
    1118                                 {
    1119                                         if (ex.Message == "Unable to write data to the transport connection.")
    1120                                         {
    1121                                                 m_bConnected = false;
    1122                                         }
    1123                                         throw ex;
    1124                                 }
    1125                                 finally
    1126                                 {
    1127                                 }                       
    1128                         }
    1129                         catch (ApplicationException aex)
    1130                         {
    1131                                 // The writer lock request timed out.
    1132                                 Debug.Write("TransmitRPC writer lock request timed out.\n");
    1133                                 throw aex;
    1134                         }
    1135                         catch (Exception OuterEx)
    1136                         {
    1137                                 throw OuterEx;
    1138                         }
     1123                     */
     1124                        return strResult;
     1125                    }
     1126                    catch (Exception ex)
     1127                    {
     1128                        if (ex.Message == "Unable to write data to the transport connection.")
     1129                        {
     1130                            m_bConnected = false;
     1131                        }
     1132                        throw ex;
     1133                    }
     1134                    finally
     1135                    {
     1136                    }
     1137                }
     1138                catch (ApplicationException aex)
     1139                {
     1140                    // The writer lock request timed out.
     1141                    Debug.Write("TransmitRPC writer lock request timed out.\n");
     1142                    throw aex;
     1143                }
     1144                catch (Exception OuterEx)
     1145                {
     1146                    throw OuterEx;
     1147                }
     1148            }
    11391149                }
    11401150
Note: See TracChangeset for help on using the changeset viewer.