- Timestamp:
- Jan 26, 2011, 5:45:02 AM (14 years ago)
- Location:
- BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/AssemblyInfo.cs
r967 r1082 28 28 // by using the '*' as shown below: 29 29 30 [assembly: AssemblyVersion("2. 2.0.*")]30 [assembly: AssemblyVersion("2.3.0.*")] 31 31 32 32 // … … 58 58 //[assembly: AssemblyKeyFile("")] 59 59 //[assembly: AssemblyKeyName("")] 60 [assembly: AssemblyFileVersionAttribute("2. 2.0.0")]60 [assembly: AssemblyFileVersionAttribute("2.3.0.0")] 61 61 [assembly: ComVisibleAttribute(false)] -
BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/BMXNet.csproj
r1063 r1082 12 12 <AssemblyKeyContainerName> 13 13 </AssemblyKeyContainerName> 14 <AssemblyName>BMXNet2 2</AssemblyName>14 <AssemblyName>BMXNet23</AssemblyName> 15 15 <AssemblyOriginatorKeyFile>wv.key.snk</AssemblyOriginatorKeyFile> 16 16 <DefaultClientScript>JScript</DefaultClientScript> … … 29 29 <SignAssembly>false</SignAssembly> 30 30 <OldToolsVersion>3.5</OldToolsVersion> 31 <TargetFrameworkVersion>v 3.5</TargetFrameworkVersion>31 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 32 32 <PublishUrl>publish\</PublishUrl> 33 33 <Install>true</Install> -
BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/BMXNetConnectInfo.cs
r1063 r1082 13 13 using System.Timers; 14 14 using System.Threading; 15 using System.Runtime.Remoting.Messaging; 15 16 16 17 … … 228 229 try 229 230 { 230 this.bmxNetLib.BMXRWL.AcquireWriterLock(5);231 //this.bmxNetLib.BMXRWL.AcquireWriterLock(5); 231 232 try 232 233 { … … 265 266 } 266 267 RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(RPMSDataTable); 267 dtEvents = (DataTable) this.Invoke(rdtd, new object[] {"BMX EVENT POLL", "BMXNetEvents"}); 268 } 268 269 //SMH - 3100110 - BMX EVENT POLL happens in the foreground. It blocks the main thread 270 //until it is done. So I changed it to async so that there would be no jerking 271 //on this thread while it's taking place. 272 //dtEvents = (DataTable) this.Invoke(rdtd, new object[] {"BMX EVENT POLL", "BMXNetEvents"}); 273 274 rdtd.BeginInvoke("BMX EVENT POLL", "BMXNetEvents", new AsyncCallback(BMXNetEventsCallback), null); 275 } 269 276 catch (Exception ex) 270 277 { … … 273 280 return; 274 281 } 275 282 /* 276 283 try 277 284 { … … 286 293 Debug.Write("upper Exception in BMXNetConnectInfo.OnEventTimer: " + ex.Message + "\n"); 287 294 } 295 288 296 try 289 297 { … … 305 313 Debug.Write("lower Exception in BMXNetConnectInfo.OnEventTimer: " + ex.Message + "\n"); 306 314 } 315 */ 307 316 } 308 317 catch(Exception ex) … … 310 319 Debug.Write("Exception in BMXNetConnectInfo.OnEventTimer: " + ex.Message + "\n"); 311 320 } 312 finally 313 { 314 this.bmxNetLib.BMXRWL.ReleaseWriterLock(); 315 this.m_timerEvent.Enabled = true; 316 } 317 } 321 finally 322 { 323 //this.bmxNetLib.BMXRWL.ReleaseWriterLock(); 324 //this.m_timerEvent.Enabled = true; 325 } 326 327 } 318 328 catch 319 329 { … … 321 331 } 322 332 } 333 334 335 /// <summary> 336 /// Callback for Async operation to get events from RPMS/VISTA server 337 /// </summary> 338 /// <param name="itfAR"></param> 339 void BMXNetEventsCallback(IAsyncResult itfAR) 340 { 341 //Define datatable we will receive results at. 342 DataTable dtEvents; 343 //Get Result 344 AsyncResult ar = (AsyncResult)itfAR; 345 //Get Original Delegate 346 RPMSDataTableDelegate rdtd = (RPMSDataTableDelegate)ar.AsyncDelegate; 347 348 //Complete the call of the delegate. We may lose connection so try catch 349 try 350 { 351 dtEvents = rdtd.EndInvoke(itfAR); 352 } 353 catch (Exception ex) 354 { 355 throw new BMXNetException("Lost connection to Server", ex); 356 } 357 358 BMXNetEventArgs args = new BMXNetEventArgs(); 359 360 //Fire off BMXNetEvent to interested subscribers 361 if (dtEvents.Rows.Count != 0) 362 { 363 foreach (DataRow dr in dtEvents.Rows) 364 { 365 args.BMXEvent = dr["EVENT"].ToString(); 366 args.BMXParam = dr["PARAM"].ToString(); 367 if (BMXNetEvent != null) 368 { 369 BMXNetEvent(this, args); 370 } 371 } 372 } 373 374 //re-enable the timer so it can check again for events 375 376 this.m_timerEvent.Enabled = true; 377 } 323 378 324 379 #endregion BMXNetEvent -
BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/BMXNetLib.cs
r1063 r1082 1027 1027 try 1028 1028 { 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";*/ 1031 1032 Variable = Variable.Replace("^","~"); 1032 1033 string sRet = "0"; … … 1035 1036 sRet = TransmitRPC("BMX LOCK", sParam); 1036 1037 bRet = (sRet == "1")?true:false; 1037 this.AppContext = sContext; 1038 /* 3110109 -- smh Commented out for performance issues. 1039 /*this.AppContext = sContext;*/ 1038 1040 return bRet; 1039 1041 } … … 1077 1079 public string TransmitRPC(string sRPC, string sParam, int nLockTimeOut) 1078 1080 { 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"); 1102 1109 #endif 1103 string strResult = ReceiveString(m_pCommSocket);1110 string strResult = ReceiveString(m_pCommSocket); 1104 1111 #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"); 1110 1117 #endif 1111 if (sOldAppContext != "") 1118 /* /* 3110109 -- smh Commented out for performance issues. 1119 * if (sOldAppContext != "") 1112 1120 { 1113 1121 this.AppContext = sOldAppContext; 1114 1122 } 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 } 1139 1149 } 1140 1150 -
BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/RPMSDb.cs
r822 r1082 87 87 { 88 88 string sRPC; 89 string sOldContext = m_rpx.AppContext; 90 91 if (m_rpx.AppContext != "BMXRPC") 92 { 93 m_rpx.AppContext = "BMXRPC"; 94 } 89 90 /* /* 3110109 -- smh Commented out for performance 91 string sOldContext = m_rpx.AppContext; 92 93 if (m_rpx.AppContext != "BMXRPC") 94 { 95 m_rpx.AppContext = "BMXRPC"; 96 } 97 */ 95 98 96 99 sRPC = "BMX UPDATE"; … … 98 101 m_sCmd = m_sCmd.Substring(nStart); 99 102 string sResult = m_rpx.TransmitRPC( sRPC, m_sCmd); 100 101 if (sOldContext != m_rpx.AppContext) 102 { 103 m_rpx.AppContext = sOldContext; 104 } 103 104 /* /* 3110109 -- smh Commented out for performance 105 if (sOldContext != m_rpx.AppContext) 106 { 107 m_rpx.AppContext = sOldContext; 108 } 109 */ 105 110 106 111 resultset = new RPMSDbResultSet(); … … 113 118 string sRPC; 114 119 string sParam; 115 string sOldContext = m_rpx.AppContext; 116 if (m_sQueryType == "SELECT") 117 { 118 if (m_rpx.AppContext != "BMXRPC") 119 { 120 m_rpx.AppContext = "BMXRPC"; 121 } 120 /* /* 3110109 -- smh Commented out for performance issues. 121 string sOldContext = m_rpx.AppContext; 122 */ 123 if (m_sQueryType == "SELECT") 124 { 125 /*/* 3110109 -- smh Commented out for performance issues. 126 if (m_rpx.AppContext != "BMXRPC") 127 { 128 m_rpx.AppContext = "BMXRPC"; 129 } 130 */ 122 131 sRPC = "BMX SQL"; 123 132 sParam = m_sCmd; … … 131 140 string sResult = m_rpx.TransmitRPC( sRPC, sParam); 132 141 142 /* 133 143 if (sOldContext != m_rpx.AppContext) 134 144 { 135 145 m_rpx.AppContext = sOldContext; 136 146 } 147 */ 137 148 138 149 return sResult;
Note:
See TracChangeset
for help on using the changeset viewer.