CHAPTER 18 572 THE .NET REMOTING LAYER (Web site templates)

CHAPTER 18 572 THE .NET REMOTING LAYER Table 18-2. Key Members of System.MarshalByRefObject Member Meaning in Life CreateObjRef() Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object GetLifetimeServices() Retrieves the current lifetime service object that controls the lifetime policy for this instance InitializeLifetimeServices() Obtains a lifetime service object to control the lifetime policy for this instance As you can tell, the gist of MarshalByRefObject is to define members that can be overridden to programmatically control the lifetime of the MBR object (more on lifetime management later in this chapter). Note Just because you have configured a type as an MBV or MBR entity does not mean it is only usable within a remoting application, just that it may be used in a remoting application. For example, the System.Windows.Forms. Form type is a descendent of MarshalByRefObject; thus, if accessed remotely it is realized as an MBR type. If not, it is just another local object in the client s application domain. Note As a corollary to the previous note, understand that if a .NET type is not serializable and does not include MarshalByRefObject in its inheritance chain, the type in question can only be activated and used in the originating application domain (meaning, the type is context bound; see Chapter 13 for more details). Now that you understand the distinct traits of MBR and MBV types, let s check out some issues that are specific to MBR types (MBV types need not apply). Activation Choices for MBR Types:WKO or CAO? Another remoting-centric choice you face as a .NET programmer has to do with exactly when an MBR object is activated and when it should be a candidate for garbage collection on the server. This might seem like a strange choice to make, as you might naturally assume that MBR objects are created when the client requests them and die when the client is done with them. While it is true that the client is the entity in charge of instructing the remoting layer it wishes to communicate with a remote type, the server application domain may (or may not) create the type at the exact moment the client s code base requests it. The reason for this seemingly strange behavior has to do with the optimization. Specifically, every MBR type may be configured to be activated using one of two techniques: As a well-known object (WKO) As a client-activated object (CAO) Note A potential point of confusion is that fact that the acronym WKO is also called a server-activated object (SAO) in the .NET literature. In fact, you may see the SAO acronym in various .NET-centric articles and books. In keeping with the current terminology, I will use WKO throughout this chapter.
We recommend high quality webhost to host and run your jsp application: christian web host services.

Leave a Reply