亚洲aⅴ电影,一级黄色片a,最近免费视频中文2019完整版 http://www.dpkxx.com/en 移動應(yīng)用運(yùn)營平臺 Thu, 08 Aug 2019 08:50:05 +0000 en-US hourly 1 https://wordpress.org/?v=4.8 http://www.dpkxx.com/wp-content/uploads/2017/06/C512-c.png RPC框架技術(shù) – Cobub http://www.dpkxx.com/en 32 32 (中文) RPC框架技術(shù)初窺 http://www.dpkxx.com/en/the_preliminary_discussion_of_rpc_technology/ Mon, 21 Aug 2017 01:37:12 +0000 http://www.dpkxx.com/?p=6919 (中文)

RPC是什么

RPC(Remote Procedure Call Protocol)——遠(yuǎn)程過程調(diào)用協(xié)議,它是一種通過網(wǎng)絡(luò)從遠(yuǎn)程計(jì)算機(jī)程序上請求服務(wù),而不需要了解底層網(wǎng)絡(luò)技術(shù)的協(xié)議。
RPC采用客戶機(jī)/服務(wù)器模式。請求程序就是一個客戶機(jī),而服務(wù)提供程序就是一個服務(wù)器。首先,客戶機(jī)調(diào)用進(jìn)程發(fā)送一個有進(jìn)程參數(shù)的調(diào)用信息到服務(wù)進(jìn)程,然后等待應(yīng)答信息。在服務(wù)器端,進(jìn)程保持睡眠狀態(tài)直到調(diào)用信息到達(dá)為止。當(dāng)一個調(diào)用信息到達(dá),服務(wù)器獲得進(jìn)程參數(shù),計(jì)算結(jié)果,發(fā)送答復(fù)信息,然后等待下一個調(diào)用信息,最后,客戶端調(diào)用進(jìn)程接收答復(fù)信息,獲得進(jìn)程結(jié)果,然后調(diào)用執(zhí)行繼續(xù)進(jìn)行。
以上是百度百科對RPC的解釋。
一個通俗的描述是:客戶端在不知道調(diào)用細(xì)節(jié)的情況下,調(diào)用存在于遠(yuǎn)程計(jì)算機(jī)上的某個對象,就像調(diào)用本地應(yīng)用程序中的對象一樣。

(中文) RPC框架技術(shù)初窺,首發(fā)于Cobub

]]>
What is RPC?

RPC (Remote Procedure Call Protocol) – Remote Procedure Call Protocol, which is a Protocol for requesting services from Remote computer programs over a network without the need to understand underlying network technologies.
RPC USES client/server mode.A requester is a client, and a service provider is a server.First, the client call process sends a process parameter call to the service process and waits for the reply message.On the server side, the process stays asleep until the call is reached.When a call information to the server process parameters, the calculation results, send a reply information, and then wait for the next call information, in the end, the client calling process to receive a reply information, obtain process as a result, and then call to continue execution.
The above is baidu encyclopedia’s explanation to RPC.
A popular description is that the client invokes an object that exists on a remote machine, just like the object in a local application, without knowing the invocation details.

The background of RPC

In the early days of the single machine, there were many processes running on one computer.If A process requires A drawing function, B process also requires A drawing function, and the programmer must write A drawing of the function for both processes.Isn’t that the whole thing?The IPC (inter-process communication, the inter-process communication between processes running in a single machine) occurs.OK, now that A has the function of drawing, B will call the drawing function on process A.
In the Internet age, everyone’s computers are connected.Previous programs can only invoke processes on their own computers, can they invoke processes on other machines?The programmer then extends the IPC to the network, which makes RPC.
This time the drawing function can be used as an independent service for clients.

RPC framework features

The RPC protocol

Since the agreement is just a set of specifications, it needs someone to follow the specification.Currently, typical RPC implementations include: Dubbo, Thrift, GRPC, Hetty, etc.

Network protocol and network IO transparent

Now that the RPC client considers itself to be calling the local object.So the transport layer USES TCP/UDP or the HTTP protocol, which is some other network protocol that doesn’t need to be concerned.Now that the network protocol is transparent to it, there is no need to care about which network IO model caller is used during the call process.

The information format is transparent to it

In a local application, an object call needs to pass some parameters, and a call result is returned.The inside of the object is how to use these parameters and calculate the result of the processing, and the caller is not concerned.So for the RPC, these parameters will be in a message format is passed to another computer on the network, how the information format is built up, the caller is not need to care about.

Language skills

The caller doesn’t actually know what language the remote server’s application is using.So for the caller, whatever language is used on the server side, this call should be successful, and the return value should be in accordance with the caller procedures described in the form of language can understand.

How the RPC framework works


1. Invoking the client handle; Execute transmission parameter
2. Call the local system kernel to send network messages
3. The message is sent to the remote host
4. The server handle gets the message and takes the parameters
5. Perform remote procedure
6. The execution process returns the result to the server handle
7. The server handle returns the result and invokes the remote system kernel
8. The message returns to the local host
9. The client handle receives the message from the kernel
10. The customer receives the data from the handle

Work on your own RPC framework

Code implementation to do the work

1. Design external interfaces

public interface IService extends Remote {  
  
    public String queryName(String no) throws RemoteException;  
  
}

2. Service implementation of the server

public class ServiceImpl extends UnicastRemoteObject implements IService {  
    
    private static final long serialVersionUID = 682805210518738166L;  
    
    protected ServiceImpl() throws RemoteException {  
        super();  
    }  
   
    @Override  
    public String queryName(String no) throws RemoteException {  
        // the concrete realization of the method    
        return String.valueOf(System.currentTimeMillis());  
    }  
}

3. RMI server implementation

public class Server {  
    public static void main(String[] args) {    
        Registry registry = null;  
        try {  
            // create a service registry manager
            registry = LocateRegistry.createRegistry(8088);  
        } catch (RemoteException e) {        
        }  
        try {  
            //create a service 
            ServiceImpl server = new ServiceImpl();  
            // name the service binding 
            registry.rebind("vince", server);   
        } catch (RemoteException e) {                
        }  
    }  
}  

4. client-side implementation

public class Client {  
    public static void main(String[] args) {  
        Registry registry = null;  
        try {  
            // get the service registry manager  
            registry = LocateRegistry.getRegistry("127.0.0.1",8088);   
        } catch (RemoteException e) {  
        }  
        try {  
            // get the service by name   
            IService server = (IService) registry.lookup("vince");  
            // call the remote method to get the result.
            String result = server.queryName("ha ha ha ha");   
        } catch (Exception e)  {            
        }  
    }  
}  

(中文) RPC框架技術(shù)初窺,首發(fā)于Cobub

]]>