[. NetRemoting-2], remoting-2
[Remoting architecture]
[1] is an important component of. NetFramework.
[2] two important features of the framework
[A] basic implementation [B] scalability/customization
[Components]
[1] [client, client application domain]
[Composition]
[A] Proxy [Proxy]
[B] Formatter [Formatter]
[C] Channel]
[Key points]
1. Always interact with the server object through Proxy [Proxy]
2. [Proxy] knows the exact location of the Remote Object
[Proxy and remote object]
[A] The Client requests A property or method from the Proxy. The Proxy sends the request to the server object ==> [typical Proxy mode]
[B] binding relationship between proxy and remote object
[Proxy]
[Two parts]
[Transparent Proxy, Transparent Proxy]
Provides the same interface as the service object to convert [Stack Frame, Stack Frame] to [Message, Message]
[Real Proxy, Real Proxy]
Uses the [Formatter and Formatter] to serialize messages, [block] The client program, and send messages after strong serialization to [Channel, Channel]
Message]
[Process of sending a request from the client]
[Obj] --> [transparent proxy] --> [real proxy] --> [formatter] --> [Channel] ----> [arrive at server]
[2] [server, Host application domain]
[Composition]
[A] Channel [Channel]
[B] Formatter [Formatter]
[C] Stack Builder [Stack Builder]
Note]
[A] The Host Program keeps listening to the port opened by Remoting.
[Server processing process]
Keep listening --> [Channel receives Message] --> [Formatter, deserialization] --> [Stack Builder, create or retrieve an object, and call the object method to get the method return, and encapsulated as a message] --> [Formatter, serialization] -->
[Send to Channel] -----> [return to client]
* Three activation methods for Remoting object [transfer reference mails]
[Commonalities]
[Create a service object and keep it in the host domain]
[A] Activate Client activated on the Client]
==> Create an exclusive remote object to serve it, and the object State remains
==> Disadvantages:
(1) increasing the pressure on the server; (2) wasting system resources on the server [the server maintains the object state all the time]
[B .1] the Server activates Singleton. [Server activated Singleton]
==> All clients share the same object, but the following logs cannot re-create objects. The service type must provide constructors without parameters.
==> Consider Thread Synchronization
[B .2] the Server activates SingleCall. [Server activated SingleCall]
==> Create an object for each request, and 2. Return the support destroy object in each method.
==> It will not take too long to occupy Resources
==> Do not save the object status
==> Developers must write Program Logic maintenance bodies themselves
==> The service type must provide constructors without Parameters
[Server activation] ==> [Well-KnowOject, WKO]