Creation process for MTS components

zhaozj2021-02-11  192

Creation Process of MTS Components Lostall · COM Concentration Camp

The creation process of a MTS component contains the following steps:

1. A client calls CreateObject for a COM object registered in MTS

2. The registry setting of this COM object indicates that it is an MTS object, so create a hand to MTS

EXECUTIVE (MTS executor)

3. COM runtime Load MTS Executive into the MTS agent, the MTS agent is MTS.exe

4. MTS Executive loads COM DLL and creates a class instance of it. MTS is also a factory

Generate a packaging program

5. Then MTS Executive Creates Object Context and Context Wrapper (Environment Pack)

Object Context Wrapper implements the interface of true authenticator object request.

6. MTS Executive returns the Context Wrapper object pointer to the client. Note that the client thinks it

Create an instance of a component object, but does not create an object.

7. MTS when the customer uses a method of calling the components with the obtained Context Wrapper object

EXECUTIVE This time you get the class packager from Object Context, and true creation of a component object instance

. The client invokes the interface pointer of the component object instance through the MTS executor.

8. MTS Executive calls the iObjectControl :: Active function of the COM component to inform the component it has been

Active, the component can get its Object Context pointer during this time.

9. The client completes the way to call the components

10. Component object is determined by the result of the method to determine whether it is submitted or aborted, setcomplete or setabort

. 11. MTS Executive Call Components IObjectControl :: deActivate, and remove it from Object Wrapper

Icon, put the object into the object pool. Note that the customer held at this time is not empty, because this point

The needle is the MTS EXECUTIVE object pointer, of course, is not released.

12. When the customer calls the component method again, MTS EXECUTIVE gets an object from the object pool, then

Call an Active and then complete the method call on the new component object.

Note: It can be seen that the customer only after calling IObjectControl :: Active, the logo is really getting

The pointer to the COM component object can be used to call, before this, it is fake. Recently, each component is activated.

To the IObjectContext pointer, because the component is taken from the object pool, it may be no longer used components

.

other:

1. When adding components to MTS, you can choose to let the DLL are in the creator process? Pay attention to this founder

The process does not refer to remote client programs, for web applications, MTS clients are IIS.

2. When you call a component in a package, all DLLs in this package will be loaded. Such as

If there is a DLL loading failed, the entire call failed.

3. A COM DLL handed over to MTS management is just a normal DLL, both it does not inherit.

IOBJECTCONTROL, there is no use of IObjectContext in its program, although it can pass

GetObjectContext () gets the object context. This component can still get from MTS, such as JIT (both time activation)

Function. And the DLL designed as an MTS component is inherited from IObjectControl, and

Like a context pointer, there can be some features of MTS, such as transaction management, and more.

4. If an MTS component needs to be debugged, the activation type of the package in which this component is located.

For the library applications.

5. The connection point problem in the MTS.

Take a look at this call sequence: a. Create component B.ADVISE to establish a connection C. Call the component a method d. Disposing connection, release components

Track discovery, the connection point is not established when calling activate, and the method of calling the component is already

established. This shows that the components are created when the method is really called the component, so B has no effect, so call

The connection point cannot be used when using Activate. When the call is completed, the connection relationship is established again. carried out

D Release the assembly, if the component has a pool characteristics, the component is not really released, but put it in the object pool.

In the next time you create it, take it directly from the pool. Because the connection is released, COM calls

DEACTIVATE () cannot be used again.

6. Each package in COM is an application, all of which is a process. Can you set whether it is idle?

Start the server process, or turn off the server process for a few minutes. Be careful, start a service

The process is very slow. You can change this setting for the application in Component Service, observe it.

Run status, as well as constantly create components to experience the relationship between the creation speed and the server process is in operation

. It can be found that if the server process is running, create very fast, otherwise the usage of the BR> MTS component is almost the same as the related part of COM , maybe some details are different. Have

The book says that MTS 2.0 does not support object pool features, and the MTS component can only be Aparment type. I have not tried it, no

If the component is to support the object pool, it is best to be free or neutral, because there may be different lines.

Circuit type customers use it, so efficient. Also there must be said that it must be aparment type, but I

Don't do this. The creation process of the other components is different, and COM has written COM base settings.

Shi, including CoCreateInstance. Creating COM To determine if the component is registered in the COM directory, both

No in the Component Service is added to an Application. If you are registered, start DLLHOST.EXE

And create components in it. MTS is obviously not this, it is estimated that the agent is set in the app.

For MTS.exe, this starts MTS.exe as a proxy. I think since COM has already come out, MTS slowly

It is necessary to quit the historical stage, so everything should be based on COM , MTS regardless of it.

转载请注明原文地址:https://www.9cbs.com/read-4506.html

New Post(0)