Mercurial > hg > release > icedtea7-2.1
changeset 1570:9eb9c1670c99
Add SharedSecrets stuff.
2009-01-13 Andrew John Hughes <gnu_andrew@member.fsf.org>
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaIODeleteOnExitAccess.java,
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java:
Add missing SharedSecrets files.
author | Andrew John Hughes <gnu_andrew@member.fsf.org> |
---|---|
date | Wed, 14 Jan 2009 05:29:15 +0000 |
parents | 3f4c11b93ded |
children | dbdaa8e2cf1f |
files | ChangeLog overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaIODeleteOnExitAccess.java overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java |
diffstat | 3 files changed, 135 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jan 14 05:27:57 2009 +0000 +++ b/ChangeLog Wed Jan 14 05:29:15 2009 +0000 @@ -1,3 +1,9 @@ +2009-01-13 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaIODeleteOnExitAccess.java, + * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java: + Add missing SharedSecrets files. + 2009-01-13 Andrew John Hughes <gnu_andrew@member.fsf.org> * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/net/StandardProtocolFamily.java,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaIODeleteOnExitAccess.java Wed Jan 14 05:29:15 2009 +0000 @@ -0,0 +1,43 @@ +/* JavaIODeleteOnExitAccess.java + Copyright (C) 2009 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package org.classpath.icedtea.misc; + +public interface JavaIODeleteOnExitAccess +{ + void add(String path); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java Wed Jan 14 05:29:15 2009 +0000 @@ -0,0 +1,86 @@ +/* SharedSecrets.java + Copyright (C) 2009 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +/** Based on sun.misc.SharedSecrets */ +package org.classpath.icedtea.misc; + +import sun.misc.Unsafe; + +/** A repository of "shared secrets", which are a mechanism for + calling implementation-private methods in another package without + using reflection. A package-private class implements a public + interface and provides the ability to call package-private methods + within that package; the object implementing that interface is + provided through a third package to which access is restricted. + This framework avoids the primary disadvantage of using reflection + for this purpose, namely the loss of compile-time checking. */ + +public class SharedSecrets +{ + private static final Unsafe unsafe = Unsafe.getUnsafe(); + private static JavaIODeleteOnExitAccess javaIODeleteOnExitAccess; + private static JavaUtilConcurrentThreadPoolExecutorAccess javaUtilConcurrentThreadPoolExecutorAccess; + + public static void setJavaIODeleteOnExitAccess(JavaIODeleteOnExitAccess jida) + { + javaIODeleteOnExitAccess = jida; + } + + public static JavaIODeleteOnExitAccess getJavaIODeleteOnExitAccess() + { + if (javaIODeleteOnExitAccess == null) + { + unsafe.ensureClassInitialized(java.io.File.class); + } + return javaIODeleteOnExitAccess; + } + + public static void setJavaUtilConcurrentThreadPoolExecutorAccess(JavaUtilConcurrentThreadPoolExecutorAccess juctpea) + { + javaUtilConcurrentThreadPoolExecutorAccess = juctpea; + } + + public static JavaUtilConcurrentThreadPoolExecutorAccess getJavaUtilConcurrentThreadPoolExecutorAccess() + { + if (javaUtilConcurrentThreadPoolExecutorAccess == null) + { + unsafe.ensureClassInitialized(java.util.concurrent.ThreadPoolExecutor.class); + } + return javaUtilConcurrentThreadPoolExecutorAccess; + } + +}