有人可以给出Hello World的简单RMI回调示例吗?我一直在努力研究它,但我似乎无法找到一个我理解的.我不明白回调是什么/做什么.
这是我目前的Hello World RMI,如果它有帮助...
接口
package example.hello;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Hello extends Remote {
String sayHello() throws RemoteException;
}
Run Code Online (Sandbox Code Playgroud)
客户
package example.hello;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class Client {
private Client(){}
public static void main(String[] args){
String host = (args.length < 1) ? null : args[0];
try{
Registry registry = LocateRegistry.getRegistry(host);
Hello stub = (Hello) registry.lookup("Hello");
String response = stub.sayHello();
System.out.println("response: " + response);
} catch (Exception e) {
System.err.println("Client exception: " + e.toString());
e.printStackTrace(); …Run Code Online (Sandbox Code Playgroud) adb shell dumsys meminfo 返回的内存是以 kB 为单位还是以 KB 为单位?
在哪里:
kB = 1000 bytes
KB = 1024 bytes
Run Code Online (Sandbox Code Playgroud)