The cluster directory service directory, which represents multiple Invoker, can be viewed as LIST<INVOKER>, and its value may be dynamically changed such as registry push changes. Cluster selects all services through directory service when invoking service
Interface definitions for Directory
Public Interface Directory<t> extends Node {
// service type
Class<t>getinterface ();
// list the executable objects for all services
List<invoker<t>>list (invocation invocation) throws rpcexception;
}
There are two specific implementations of directory
Staticdirectory: Static directory service, all of its invoker passed through the constructor, the service consumer refers to the service, the service to the multi-Registry reference, the Invokers collection directly into the Staticdirectory constructor, And then disguised as a invoker by cluster.
The Staticdirectory list method returns all Invoker collections directly
Registrydirectory: Register directory service, its Invoker collection is obtained from the registry, it implements the Notifylistener interface implements the callback interface notify (list<url>).
For example, the consumer to invoke a remote service, the registry will be subscribed to all the service providers of the service, the subscription and service provider data changes when the consumer's Notifylistener service callback notify Method Notifylistener.notify (List <Url>) callback interface to the provider's URL address of all services and then convert the URLs to Invokers, which is the refer Application remote service
All invokers that are called to this remote service are available in the registrydirectory referencing a remote service at this time.
Registrydirectory.list (invocation) is the Invoker execution object that gets all the remote service references based on the service invocation method
Dubbo Principle Analysis-Cluster & fault Tolerant directory Services