Java 类com.sun.jdi.connect.TransportTimeoutException 实例源码

项目:jdk8u-jdk    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:openjdk-jdk10    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:openjdk9    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:google-cloud-eclipse    文件:SocketTransportService.java   
@Override
public Connection accept(ListenKey listenKey, long attachTimeout, long handshakeTimeout) throws IOException {
    if (attachTimeout > 0) {
        if (attachTimeout > Integer.MAX_VALUE) {
            attachTimeout = Integer.MAX_VALUE; // approx 25 days!
        }
        fServerSocket.setSoTimeout((int) attachTimeout);
    }
    Socket socket;
    try {
        socket = fServerSocket.accept();
    } catch (SocketTimeoutException e) {
        throw new TransportTimeoutException();
    }
    InputStream input = socket.getInputStream();
    OutputStream output = socket.getOutputStream();
    performHandshake(input, output, handshakeTimeout);
    return new SocketConnection(socket, input, output);
}
项目:jdk8u_jdk    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:infobip-open-jdk-8    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:jdk8u-dev-jdk    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:jdk7-jdk    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:openjdk-source-code-learn    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:OLD-OpenJDK8    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:JAVA_UNIT    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:openjdk-icedtea7    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:openjdk-jdk7u-jdk    文件:AcceptTimeout.java   
public static void main(String args[]) throws Exception {
    List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors();
    for (ListeningConnector lc: connectors) {
        Map<String,Connector.Argument> cargs = lc.defaultArguments();
        Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout");

        /*
         * If the Connector has a argument named "timeout" then we set the timeout to 1 second
         * and start it listening on its default address. It should throw TranpsortTimeoutException.
         */
        if (timeout != null) {
            System.out.println("Testing " + lc.name());
            timeout.setValue(1000);

            System.out.println("Listening on: " + lc.startListening(cargs));
            try {
                lc.accept(cargs);
                throw new RuntimeException("Connection accepted from some debuggee - unexpected!");
            } catch (TransportTimeoutException e) {
                System.out.println("Timed out as expected.\n");
            }
            lc.stopListening(cargs);
        }
    }
}
项目:openjdk-jdk10    文件:SocketTransportService.java   
/**
 * Accept a connection from a debuggee and handshake with it.
 */
public Connection accept(ListenKey listener, long acceptTimeout, long handshakeTimeout) throws IOException {
    if (acceptTimeout < 0 || handshakeTimeout < 0) {
        throw new IllegalArgumentException("timeout is negative");
    }
    if (!(listener instanceof SocketListenKey)) {
        throw new IllegalArgumentException("Invalid listener");
    }
    ServerSocket ss;

    // obtain the ServerSocket from the listener - if the
    // socket is closed it means the listener is invalid
    synchronized (listener) {
        ss = ((SocketListenKey)listener).socket();
        if (ss.isClosed()) {
           throw new IllegalArgumentException("Invalid listener");
        }
    }

    // from here onwards it's possible that the ServerSocket
    // may be closed by a call to stopListening - that's okay
    // because the ServerSocket methods will throw an
    // IOException indicating the socket is closed.
    //
    // Additionally, it's possible that another thread calls accept
    // with a different accept timeout - that creates a same race
    // condition between setting the timeout and calling accept.
    // As it is such an unlikely scenario (requires both threads
    // to be using the same listener we've chosen to ignore the issue).

    ss.setSoTimeout((int)acceptTimeout);
    Socket s;
    try {
        s = ss.accept();
    } catch (SocketTimeoutException x) {
        throw new TransportTimeoutException("timeout waiting for connection");
    }

    // handshake here
    handshake(s, handshakeTimeout);

    return new SocketConnection(s);
}