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.
This commit is contained in:
parent
37366be3d9
commit
dbd2742358
|
@ -27,7 +27,7 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("2.2.0.*")]
|
||||
[assembly: AssemblyVersion("2.3.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
|
@ -57,5 +57,5 @@ using System.Runtime.InteropServices;
|
|||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
//[assembly: AssemblyKeyName("")]
|
||||
[assembly: AssemblyFileVersionAttribute("2.2.0.0")]
|
||||
[assembly: AssemblyFileVersionAttribute("2.3.0.0")]
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>BMXNet22</AssemblyName>
|
||||
<AssemblyName>BMXNet23</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>wv.key.snk</AssemblyOriginatorKeyFile>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
|
@ -28,7 +28,7 @@
|
|||
</UpgradeBackupLocation>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
|
|
|
@ -12,6 +12,7 @@ using System.Text;
|
|||
using System.Security.Cryptography;
|
||||
using System.Timers;
|
||||
using System.Threading;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
|
||||
|
||||
namespace IndianHealthService.BMXNet
|
||||
|
@ -227,7 +228,7 @@ namespace IndianHealthService.BMXNet
|
|||
{
|
||||
try
|
||||
{
|
||||
this.bmxNetLib.BMXRWL.AcquireWriterLock(5);
|
||||
//this.bmxNetLib.BMXRWL.AcquireWriterLock(5);
|
||||
try
|
||||
{
|
||||
this.m_timerEvent.Enabled = false;
|
||||
|
@ -264,7 +265,13 @@ namespace IndianHealthService.BMXNet
|
|||
this.CreateHandle();
|
||||
}
|
||||
RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(RPMSDataTable);
|
||||
dtEvents = (DataTable) this.Invoke(rdtd, new object[] {"BMX EVENT POLL", "BMXNetEvents"});
|
||||
|
||||
//SMH - 3100110 - BMX EVENT POLL happens in the foreground. It blocks the main thread
|
||||
//until it is done. So I changed it to async so that there would be no jerking
|
||||
//on this thread while it's taking place.
|
||||
//dtEvents = (DataTable) this.Invoke(rdtd, new object[] {"BMX EVENT POLL", "BMXNetEvents"});
|
||||
|
||||
rdtd.BeginInvoke("BMX EVENT POLL", "BMXNetEvents", new AsyncCallback(BMXNetEventsCallback), null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -272,7 +279,7 @@ namespace IndianHealthService.BMXNet
|
|||
this.m_timerEvent.Enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
if (dtEvents.Rows.Count == 0)
|
||||
|
@ -285,6 +292,7 @@ namespace IndianHealthService.BMXNet
|
|||
{
|
||||
Debug.Write("upper Exception in BMXNetConnectInfo.OnEventTimer: " + ex.Message + "\n");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//If events exist, raise BMXNetEvent
|
||||
|
@ -304,6 +312,7 @@ namespace IndianHealthService.BMXNet
|
|||
{
|
||||
Debug.Write("lower Exception in BMXNetConnectInfo.OnEventTimer: " + ex.Message + "\n");
|
||||
}
|
||||
*/
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
@ -311,9 +320,10 @@ namespace IndianHealthService.BMXNet
|
|||
}
|
||||
finally
|
||||
{
|
||||
this.bmxNetLib.BMXRWL.ReleaseWriterLock();
|
||||
this.m_timerEvent.Enabled = true;
|
||||
//this.bmxNetLib.BMXRWL.ReleaseWriterLock();
|
||||
//this.m_timerEvent.Enabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -321,6 +331,51 @@ namespace IndianHealthService.BMXNet
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Callback for Async operation to get events from RPMS/VISTA server
|
||||
/// </summary>
|
||||
/// <param name="itfAR"></param>
|
||||
void BMXNetEventsCallback(IAsyncResult itfAR)
|
||||
{
|
||||
//Define datatable we will receive results at.
|
||||
DataTable dtEvents;
|
||||
//Get Result
|
||||
AsyncResult ar = (AsyncResult)itfAR;
|
||||
//Get Original Delegate
|
||||
RPMSDataTableDelegate rdtd = (RPMSDataTableDelegate)ar.AsyncDelegate;
|
||||
|
||||
//Complete the call of the delegate. We may lose connection so try catch
|
||||
try
|
||||
{
|
||||
dtEvents = rdtd.EndInvoke(itfAR);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new BMXNetException("Lost connection to Server", ex);
|
||||
}
|
||||
|
||||
BMXNetEventArgs args = new BMXNetEventArgs();
|
||||
|
||||
//Fire off BMXNetEvent to interested subscribers
|
||||
if (dtEvents.Rows.Count != 0)
|
||||
{
|
||||
foreach (DataRow dr in dtEvents.Rows)
|
||||
{
|
||||
args.BMXEvent = dr["EVENT"].ToString();
|
||||
args.BMXParam = dr["PARAM"].ToString();
|
||||
if (BMXNetEvent != null)
|
||||
{
|
||||
BMXNetEvent(this, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//re-enable the timer so it can check again for events
|
||||
|
||||
this.m_timerEvent.Enabled = true;
|
||||
}
|
||||
|
||||
#endregion BMXNetEvent
|
||||
|
||||
#region Fields
|
||||
|
|
|
@ -1026,15 +1026,17 @@ namespace IndianHealthService.BMXNet
|
|||
{
|
||||
try
|
||||
{
|
||||
string sContext = this.AppContext;
|
||||
this.AppContext = "BMXRPC";
|
||||
/* 3110109 -- smh Commented out for performance issues.
|
||||
/*string sContext = this.AppContext;
|
||||
this.AppContext = "BMXRPC";*/
|
||||
Variable = Variable.Replace("^","~");
|
||||
string sRet = "0";
|
||||
bool bRet = false;
|
||||
string sParam = Variable + "^" + Increment + "^" + TimeOut;
|
||||
sRet = TransmitRPC("BMX LOCK", sParam);
|
||||
bRet = (sRet == "1")?true:false;
|
||||
this.AppContext = sContext;
|
||||
/* 3110109 -- smh Commented out for performance issues.
|
||||
/*this.AppContext = sContext;*/
|
||||
return bRet;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1075,6 +1077,8 @@ namespace IndianHealthService.BMXNet
|
|||
}
|
||||
|
||||
public string TransmitRPC(string sRPC, string sParam, int nLockTimeOut)
|
||||
{
|
||||
lock (this) // This method CANNOT be executed simultaneously!
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1088,30 +1092,35 @@ namespace IndianHealthService.BMXNet
|
|||
Debug.Assert(m_pCommSocket != null);
|
||||
|
||||
string sOldAppContext = "";
|
||||
/* 3110109 -- smh Commented out for performance issues.
|
||||
if (sRPC.StartsWith("BMX")&&(this.m_cAppContext != "BMXRPC"))
|
||||
{
|
||||
sOldAppContext = this.m_cAppContext;
|
||||
this.AppContext = "BMXRPC";
|
||||
}
|
||||
*/
|
||||
string sMult = "";
|
||||
string sSend = ADEBLDMsg(m_cHDR, sRPC, sParam, ref sMult);
|
||||
SendString(m_pCommSocket, sSend, sMult);
|
||||
#if TRACE
|
||||
DateTime sendTime = DateTime.Now;
|
||||
Debug.Write("TransmitRPC Sent: " + sSend.Replace((char) 30, (char) 10) + "\n");
|
||||
int threadid = Thread.CurrentThread.ManagedThreadId;
|
||||
Debug.Write("TransmitRPC Sent: (T:" + threadid + ")" + sSend.Replace((char)30, (char)10) + "\n");
|
||||
#endif
|
||||
string strResult = ReceiveString(m_pCommSocket);
|
||||
#if TRACE
|
||||
DateTime receiveTime = DateTime.Now;
|
||||
Debug.Write("TransmitRPC Received: " + strResult.Replace((char) 30, (char) 10) + "\n");
|
||||
Debug.Write("TransmitRPC Received: (T:" + threadid + ")" + strResult.Replace((char)30, (char)10) + "\n");
|
||||
TimeSpan executionTime = receiveTime - sendTime;
|
||||
Debug.Write("Execution Time: " + executionTime.TotalMilliseconds + " ms.\n");
|
||||
Debug.Write("-------------------------------------------------------\n");
|
||||
#endif
|
||||
if (sOldAppContext != "")
|
||||
/* /* 3110109 -- smh Commented out for performance issues.
|
||||
* if (sOldAppContext != "")
|
||||
{
|
||||
this.AppContext = sOldAppContext;
|
||||
}
|
||||
*/
|
||||
return strResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1136,6 +1145,7 @@ namespace IndianHealthService.BMXNet
|
|||
{
|
||||
throw OuterEx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string TransmitRPC(string sRPC, string sParam)
|
||||
|
|
|
@ -86,22 +86,27 @@ namespace IndianHealthService.BMXNet
|
|||
private void _executeUpdate(out RPMSDbResultSet resultset)
|
||||
{
|
||||
string sRPC;
|
||||
|
||||
/* /* 3110109 -- smh Commented out for performance
|
||||
string sOldContext = m_rpx.AppContext;
|
||||
|
||||
if (m_rpx.AppContext != "BMXRPC")
|
||||
{
|
||||
m_rpx.AppContext = "BMXRPC";
|
||||
}
|
||||
*/
|
||||
|
||||
sRPC = "BMX UPDATE";
|
||||
int nStart = 7;
|
||||
m_sCmd = m_sCmd.Substring(nStart);
|
||||
string sResult = m_rpx.TransmitRPC( sRPC, m_sCmd);
|
||||
|
||||
/* /* 3110109 -- smh Commented out for performance
|
||||
if (sOldContext != m_rpx.AppContext)
|
||||
{
|
||||
m_rpx.AppContext = sOldContext;
|
||||
}
|
||||
*/
|
||||
|
||||
resultset = new RPMSDbResultSet();
|
||||
resultset.recordsAffected = 1; //Make this the return value of the call
|
||||
|
@ -112,13 +117,17 @@ namespace IndianHealthService.BMXNet
|
|||
//Make rpx call
|
||||
string sRPC;
|
||||
string sParam;
|
||||
/* /* 3110109 -- smh Commented out for performance issues.
|
||||
string sOldContext = m_rpx.AppContext;
|
||||
*/
|
||||
if (m_sQueryType == "SELECT")
|
||||
{
|
||||
/*/* 3110109 -- smh Commented out for performance issues.
|
||||
if (m_rpx.AppContext != "BMXRPC")
|
||||
{
|
||||
m_rpx.AppContext = "BMXRPC";
|
||||
}
|
||||
*/
|
||||
sRPC = "BMX SQL";
|
||||
sParam = m_sCmd;
|
||||
}
|
||||
|
@ -130,10 +139,12 @@ namespace IndianHealthService.BMXNet
|
|||
|
||||
string sResult = m_rpx.TransmitRPC( sRPC, sParam);
|
||||
|
||||
/*
|
||||
if (sOldContext != m_rpx.AppContext)
|
||||
{
|
||||
m_rpx.AppContext = sOldContext;
|
||||
}
|
||||
*/
|
||||
|
||||
return sResult;
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue