< prev index next >

src/java.rmi/share/classes/sun/rmi/server/Activation.java

Print this page
rev 15876 : 8085192: java/rmi/activation/Activatable tests fail intermittently due to "Port already in use"
Reviewed-by: rriggs, mli


1953              * If rmid has an inherited channel (meaning that it was
1954              * launched from inetd), set the server socket factory to
1955              * return the inherited server socket.
1956              **/
1957             Channel inheritedChannel = AccessController.doPrivileged(
1958                 new PrivilegedExceptionAction<Channel>() {
1959                     public Channel run() throws IOException {
1960                         return System.inheritedChannel();
1961                     }
1962                 });
1963 
1964             if (inheritedChannel != null &&
1965                 inheritedChannel instanceof ServerSocketChannel)
1966             {
1967                 /*
1968                  * Redirect System.err output to a file.
1969                  */
1970                 AccessController.doPrivileged(
1971                     new PrivilegedExceptionAction<Void>() {
1972                         public Void run() throws IOException {





1973                             File file =
1974                                 Files.createTempFile("rmid-err", null).toFile();
1975                             PrintStream errStream =
1976                                 new PrintStream(new FileOutputStream(file));
1977                             System.setErr(errStream);
1978                             return null;
1979                         }
1980                     });
1981 
1982                 ServerSocket serverSocket =
1983                     ((ServerSocketChannel) inheritedChannel).socket();
1984                 port = serverSocket.getLocalPort();
1985                 ssf = new ActivationServerSocketFactory(serverSocket);
1986 
1987                 System.err.println(new Date());
1988                 System.err.println(getTextResource(
1989                                        "rmid.inherited.channel.info") +
1990                                        ": " + inheritedChannel);
1991             }
1992 




1953              * If rmid has an inherited channel (meaning that it was
1954              * launched from inetd), set the server socket factory to
1955              * return the inherited server socket.
1956              **/
1957             Channel inheritedChannel = AccessController.doPrivileged(
1958                 new PrivilegedExceptionAction<Channel>() {
1959                     public Channel run() throws IOException {
1960                         return System.inheritedChannel();
1961                     }
1962                 });
1963 
1964             if (inheritedChannel != null &&
1965                 inheritedChannel instanceof ServerSocketChannel)
1966             {
1967                 /*
1968                  * Redirect System.err output to a file.
1969                  */
1970                 AccessController.doPrivileged(
1971                     new PrivilegedExceptionAction<Void>() {
1972                         public Void run() throws IOException {
1973                             boolean disable = Boolean.getBoolean(
1974                                     "sun.rmi.server.activation.disableErrRedirect");
1975                             if (disable)
1976                                 return null;
1977 
1978                             File file =
1979                                 Files.createTempFile("rmid-err", null).toFile();
1980                             PrintStream errStream =
1981                                 new PrintStream(new FileOutputStream(file));
1982                             System.setErr(errStream);
1983                             return null;
1984                         }
1985                     });
1986 
1987                 ServerSocket serverSocket =
1988                     ((ServerSocketChannel) inheritedChannel).socket();
1989                 port = serverSocket.getLocalPort();
1990                 ssf = new ActivationServerSocketFactory(serverSocket);
1991 
1992                 System.err.println(new Date());
1993                 System.err.println(getTextResource(
1994                                        "rmid.inherited.channel.info") +
1995                                        ": " + inheritedChannel);
1996             }
1997 


< prev index next >