1 /* |
1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
24 */ |
24 */ |
25 |
25 |
26 package sun.corba; |
26 package sun.corba; |
27 |
27 |
28 import com.sun.corba.se.impl.io.ValueUtility; |
28 import com.sun.corba.se.impl.io.ValueUtility; |
|
29 import sun.misc.JavaOISAccess; |
29 import sun.misc.Unsafe; |
30 import sun.misc.Unsafe; |
30 |
31 |
|
32 import java.io.ObjectInputStream; |
31 import java.security.AccessController; |
33 import java.security.AccessController; |
32 |
34 |
33 /** A repository of "shared secrets", which are a mechanism for |
35 /** A repository of "shared secrets", which are a mechanism for |
34 calling implementation-private methods in another package without |
36 calling implementation-private methods in another package without |
35 using reflection. A package-private class implements a public |
37 using reflection. A package-private class implements a public |
41 |
43 |
42 // SharedSecrets cloned in corba repo to avoid build issues |
44 // SharedSecrets cloned in corba repo to avoid build issues |
43 public class SharedSecrets { |
45 public class SharedSecrets { |
44 private static final Unsafe unsafe = Unsafe.getUnsafe(); |
46 private static final Unsafe unsafe = Unsafe.getUnsafe(); |
45 private static JavaCorbaAccess javaCorbaAccess; |
47 private static JavaCorbaAccess javaCorbaAccess; |
|
48 private static JavaOISAccess javaOISAccess; |
46 |
49 |
47 public static JavaCorbaAccess getJavaCorbaAccess() { |
50 public static JavaCorbaAccess getJavaCorbaAccess() { |
48 if (javaCorbaAccess == null) { |
51 if (javaCorbaAccess == null) { |
49 // Ensure ValueUtility is initialized; we know that that class |
52 // Ensure ValueUtility is initialized; we know that that class |
50 // provides the shared secret |
53 // provides the shared secret |
55 |
58 |
56 public static void setJavaCorbaAccess(JavaCorbaAccess access) { |
59 public static void setJavaCorbaAccess(JavaCorbaAccess access) { |
57 javaCorbaAccess = access; |
60 javaCorbaAccess = access; |
58 } |
61 } |
59 |
62 |
|
63 public static void setJavaOISAccess(JavaOISAccess access) { |
|
64 javaOISAccess = access; |
|
65 } |
|
66 |
|
67 public static JavaOISAccess getJavaOISAccess() { |
|
68 if (javaOISAccess == null) |
|
69 unsafe.ensureClassInitialized(ObjectInputStream.class); |
|
70 |
|
71 return javaOISAccess; |
|
72 } |
|
73 |
60 } |
74 } |