I have this rather simple RMI communication.
Server:
LocateRegistry.createRegistry(settings.rmiPort).bind("server", UnicastRemoteObject.exportObject(remoteMe, 0));
private final class RemoteLobbyServerImpl implements RemoteLobbyServer {
    @Override public void registerRobotServer(RemoteRobotServer robotServer, int seq) throws RemoteException {
        System.out.println(String.valueOf(seq));
//          robotManager.setServer(robotServer);
    }
}
Client:
        final Registry registry = LocateRegistry.getRegistry(lobbyHost, lobbyRmiPort);
        log.info("Looking up lobbyserver...");
        remoteLobbyServer = (RemoteLobbyServer) registry.lookup("server");
        log.info(remoteLobbyServer.toString());
        remoteMe = new RemoteRobotServerImpl();
        final int seq = (int)(Math.random() * 10);
        log.info("Registering myself "+seq+" ...");
        Future<?> registerTask = ThreadPool.submit(new Runnable(开发者_如何学JAVA) { @Override public void run() {
            try {
                remoteLobbyServer.registerRobotServer((RemoteRobotServer) UnicastRemoteObject.exportObject(remoteMe, 0), seq);
            } catch (RemoteException e) {
                throw new RuntimeException(e);
            }
            log.info("Registered");
        }});
        try {
            registerTask.get(30, TimeUnit.SECONDS);
        } catch (TimeoutException e) {
            registerTask.cancel(true);
            throw new RuntimeException("Registration timed out");
        }
This works fine when I run it on the same machine. However, it falls apart when there is some distance between the client and the server. Then it takes about 2 minutes for the server to respond.
Linux' ping says the latency is 20 ms. Strangely though, it does take a while before it shows that, while e.g. ping google.com (also 20 ms) has results rather quickly.
What could be up? How can I analyze this?
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论