Java 类java.rmi.server.RMIFailureHandler 实例源码

项目:jdk8u-jdk    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:openjdk-jdk10    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:openjdk9    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:jdk8u_jdk    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:lookaside_java-1.8.0-openjdk    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:infobip-open-jdk-8    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:jdk8u-dev-jdk    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:jdk7-jdk    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:openjdk-source-code-learn    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:OLD-OpenJDK8    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:JAVA_UNIT    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:openjdk-jdk7u-jdk    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:openjdk-icedtea7    文件:CloseServerSocketOnTermination.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 4924577\n");

    RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
        public boolean failure(Exception e) { return false; }
    });

    tryWith(new IOException());
    tryWith(new NullPointerException());
    tryWith(new OutOfMemoryError());
    tryWith(new NoClassDefFoundError());
    tryWith(new InternalError());
    tryWith(new Throwable());

    System.err.println("TEST PASSED");
}
项目:OpenJSharp    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:jdk8u-jdk    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:openjdk-jdk10    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:openjdk9    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:jdk8u_jdk    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:infobip-open-jdk-8    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:jdk8u-dev-jdk    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:jdk7-jdk    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:openjdk-source-code-learn    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:OLD-OpenJDK8    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:cn1    文件:ServerConnectionManager.java   
/**
 * Starts waiting for incoming remote calls. When connection from remote
 * is accepted, separate thread to process remote call is spawned. Waits
 * for connections until this thread will not be interrupted.
 */
public void run() {
    while (!Thread.interrupted()) {
        try {
            Socket s = ss.accept();
            startConnection(s);
            failedAcceptsNum = 0;
        } catch (Exception ex) {
            RMIFailureHandler rfh = RMISocketFactory.getFailureHandler();

            if (rfh != null) {
                if (rfh.failure(ex)) {
                    return;
                }
            } else {
                // We will try to immediately accept another client again,
                // but if we have a bad client which fails our accept tries
                // for a number of times, we should sleep for a while.
                if (failedAcceptsNum >= 5) {
                    try {
                        Thread.sleep(defaultFailureDelay);
                    } catch (InterruptedException ie) {
                        return;
                    }
                    failedAcceptsNum = 0;
                }
            }
        }
    }
}
项目:openjdk-jdk7u-jdk    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}
项目:freeVM    文件:ServerConnectionManager.java   
/**
 * Starts waiting for incoming remote calls. When connection from remote
 * is accepted, separate thread to process remote call is spawned. Waits
 * for connections until this thread will not be interrupted.
 */
public void run() {
    while (!Thread.interrupted()) {
        try {
            Socket s = ss.accept();
            startConnection(s);
            failedAcceptsNum = 0;
        } catch (Exception ex) {
            RMIFailureHandler rfh = RMISocketFactory.getFailureHandler();

            if (rfh != null) {
                if (rfh.failure(ex)) {
                    return;
                }
            } else {
                // We will try to immediately accept another client again,
                // but if we have a bad client which fails our accept tries
                // for a number of times, we should sleep for a while.
                if (failedAcceptsNum >= 5) {
                    try {
                        Thread.sleep(defaultFailureDelay);
                    } catch (InterruptedException ie) {
                        return;
                    }
                    failedAcceptsNum = 0;
                }
            }
        }
    }
}
项目:freeVM    文件:ServerConnectionManager.java   
/**
 * Starts waiting for incoming remote calls. When connection from remote
 * is accepted, separate thread to process remote call is spawned. Waits
 * for connections until this thread will not be interrupted.
 */
public void run() {
    while (!Thread.interrupted()) {
        try {
            Socket s = ss.accept();
            startConnection(s);
            failedAcceptsNum = 0;
        } catch (Exception ex) {
            RMIFailureHandler rfh = RMISocketFactory.getFailureHandler();

            if (rfh != null) {
                if (rfh.failure(ex)) {
                    return;
                }
            } else {
                // We will try to immediately accept another client again,
                // but if we have a bad client which fails our accept tries
                // for a number of times, we should sleep for a while.
                if (failedAcceptsNum >= 5) {
                    try {
                        Thread.sleep(defaultFailureDelay);
                    } catch (InterruptedException ie) {
                        return;
                    }
                    failedAcceptsNum = 0;
                }
            }
        }
    }
}
项目:freeVM    文件:RMISocketFactoryTest.java   
public void testGetSetFailureHandler() {
    RMIFailureHandler fh = new RMIFailureHandler() {
        public boolean failure(Exception ex) {
            return false;
        }
    };

    RMISocketFactory.setFailureHandler(fh);
    assertSame(fh, RMISocketFactory.getFailureHandler());
}
项目:openjdk-icedtea7    文件:TCPTransport.java   
/**
 * Returns true if the accept loop should continue after the
 * specified exception has been caught, or false if the accept
 * loop should terminate (closing the server socket).  If
 * there is an RMIFailureHandler, this method returns the
 * result of passing the specified exception to it; otherwise,
 * this method always returns true, after sleeping to throttle
 * the accept loop if necessary.
 **/
private boolean continueAfterAcceptFailure(Throwable t) {
    RMIFailureHandler fh = RMISocketFactory.getFailureHandler();
    if (fh != null) {
        return fh.failure(t instanceof Exception ? (Exception) t :
                          new InvocationTargetException(t));
    } else {
        throttleLoopOnException();
        return true;
    }
}