DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Diadem instance Issue

hi All,

 

I will explain a bit about the scenario i'm working with. My application is a .net application( as a service) . When a test data comes in to a Filewatcher path my srvice will trigger a Diadem instance using DIAdem.TOCommand and it start processing the test. At the end of the test another Diadem instance is trigger by a Seperate thread which has a Process.Start() with parameters to instanciate the diadem instance. Till here everthing is ok. Every process i described earlier is independent of other one.

 

Now i will describe by issue..

So when the Diadem which was initiated by te Process.Start() is running or processing. i was not able to run another test(on test data reaching the Filewatcher path) which will make use of the DIadem.ToCommand. I checked the property INterface is locked and it says it is locked.

 

Why i'm not able to start a new diadem instance?

 

I have changed the regitry entry for instancing to 1.(in both places)

 

 

With reagards,

 

SKB

0 Kudos
Message 1 of 7
(4,035 Views)

Hi SKB,

 

I find several things about your post confusing, but first let me state what I know to be the case.  If the instacing parameter is set to 0, each ActiveX connection will point to the same DIAdem instance, and multiple concurrent connections can potentially step on each other's toes.  If instead you set the instancing parameter to 1, the each ActiveX connection will launch an independent instance of DIAdem, such that you are guaranteed that multiple concurrent connections will never affect each other.  You can try this yourself with this simple VBScript that can be run in the Windows Script Host by just double-clicking it or typing the file name (in double quotes) in a DOS shell.

Dim ToCommand1, ToCommand2, Value1, Value2
MsgBox "Initializing..."
Set ToCommand1 = CreateObject("DIAdem.ToCommand")
Set ToCommand2 = CreateObject("DIAdem.ToCommand")
Call ToCommand1.CmdExecuteSync("L1:= 1")
Call ToCommand2.CmdExecuteSync("L1:= 2")
Call ToCommand1.IntegerVarGet("L1", Value1)
Call ToCommand2.IntegerVarGet("L1", Value2)
MsgBox "Instance1 Value = " & Value1 & vbCRLF & "Instance2 Value = " & Value2

 

Now to the parts of your email which confuse me.  What is this Process.Start() method you speak of?  That doesn't look like anything in the DIAdem ActiveX server-- is this part of your code?  Second, what is this "property INterface" you speak of, and what does it mean for this to be "locked"?  My understanding of the "bInterfaceLocked" property is that this tells you the status of your instantiated instance/connection-- is this what you're referring to?  In this case, you request a new instance, then loop until this property says the instance is ready.  Why are you checking this property prior to creating a new DIAdem instance?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 7
(4,008 Views)

Hi brad,

I will try to explain a bit more of the scenario

I have set the Instancing to 1.

 

First part of my code will be initiating the Diadem using oDIAdem = CreateObject("DIAdem.TOCommand"), once this process is done I'm calling again another diadem instance using the Process.Start() with another set of start parameters.(Why I'm using Process.Start()  to call the second isntance of diadem is because it have much better control on PID)Both these process are in Different threads. Actually my intention is to keep the First part independent of the other one.

 

Thread1: As soon as file comes in 'Monitor path' "DIAdem.TOCommand" invokes a Diadem with PID '1000', - This process that file and moved it to a Folder Archive, Diadem closes once its finished.( oDIAdem = Nothing)

Thread2 On receiving the file to the folder Archive  Process.Start() invokes a Diadem instance with PID '2000'

 

Meantime user pushes another file in to the 'Monitor path' , this should use of the Thread1 which has "DIAdem.Tocommand" to invoke another instance. But that is not happening. When ever a diadem instance  which is been called using Process.Start() is running. "DIAdem.Tocommand" says Interface is locked (bInterfaceLocked)

 

I have tested whether Two diadem instance is running in parallel by giving a delay before the Process.start(). and pushed a file to invoke another diadem instance. Yes that worked. So that means  when a Diadem is running which is called using Process.Start() , stops "DIAdem.Tocommand" to generate another instance.

 

Hope you got what I'm saying. I know the example you are given is clear and it will work out. But here in my same code I;m using Process.Start() to invoke a diadem. Which screws the party. Let me know if you have any suggestions.

 

Regards,

SKB

0 Kudos
Message 3 of 7
(3,982 Views)

Hi Brad,

 

I was able to find a solution for the issue. I checked whether the interface is locked. If its locked I made the thread to sleep for 15 seccs and called the "Diadem.ToCommand()' again. By doing do i was able to create another instance.

 

 

Thank you for all th support

 

Regards,

 

SKB

0 Kudos
Message 4 of 7
(3,966 Views)

Hi SKB,

 

Are you sure the second time (after the 15 second delay) you create an ActiveX connection to DIAdem you are really getting a new instance and not connecting to the already running Process.Start() instance?  Based on what you described, it sounds like the DIAdem ActiveX interface blocks any new ActiveX connection attempts until the Process.Start() instance is finished launching.  The simplest explanation for that would be that the second ActiveX connection is in fact latching onto the Process.Start() instance of DIAdem, but it can't do so until that instance has successfully finished launching.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 5 of 7
(3,961 Views)

Hi Brad,

 

 By doing so I'm getting a new instance. It is not getting connected to the Instance created by Process.Start().

 

As u described, I  created a do loop which sleeps until the interface is unlocked. But that is not working here. Interfacelock is not getting unlocked until the instance created by Process.Start() finish processing.

 

Only option left in front of me is to try to call or create ActiveX component by calling DIADEM.TOcommand() again and again . It worked for my surprise. Actually if we speak it should not work if the case is like as explained earlier.

 

With regards,

 

SKB

0 Kudos
Message 6 of 7
(3,921 Views)

Hi SKB,

 

You say that BInterfaceLocked stays true until the Process.Start() DIAdem instance is "finished processing", but this is ambiguous.  By "finished processing", do you mean that this DIAdem instance is no longer running a VBScript, or do you mean that this DIAdem instance ends completely?  In the former case this would be the designed behaviour of the BInterfaceLocked property.  In the latter case this would be strange.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments 

0 Kudos
Message 7 of 7
(3,895 Views)