summaryrefslogtreecommitdiff
path: root/java/openjdk6/files/icedtea/security/20130201/7141694.patch
blob: 66d69a7b69a7bdf874ed9cfdf61c0feba38a0d59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# HG changeset patch
# User mbankal
# Date 1355396891 28800
# Node ID 7eb471f1efdd127f982e53b290c1fece845a897c
# Parent  58fdb67fcacc67693fc43b5601e88bd7c216f850
7141694: Improving CORBA internals
Reviewed-by: coffeys, ahgross

diff --git a/src/share/classes/com/sun/corba/se/spi/orb/ORB.java b/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
--- corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
+++ corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@ import com.sun.corba.se.impl.presentatio
 import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
 
 import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
+import sun.awt.AppContext;
 
 public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
     implements Broker, TypeCodeFactory
@@ -173,14 +174,7 @@ public abstract class ORB extends com.su
 
     private MonitoringManager monitoringManager;
 
-    // There is only one instance of the PresentationManager
-    // that is shared between all ORBs.  This is necessary
-    // because RMI-IIOP requires the PresentationManager in
-    // places where no ORB is available, so the PresentationManager
-    // must be global.  It is initialized here as well.
-    protected static PresentationManager globalPM = null ;
-
-    static {
+    private static PresentationManager setupPresentationManager() {
         staticWrapper = ORBUtilSystemException.get(
             CORBALogDomains.RPC_PRESENTATION ) ;
 
@@ -220,17 +214,26 @@ public abstract class ORB extends com.su
                 }
             ) ;
 
-        globalPM = new PresentationManagerImpl( useDynamicStub ) ;
-        globalPM.setStubFactoryFactory( false,
+        PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ;
+        pm.setStubFactoryFactory( false,
             PresentationDefaults.getStaticStubFactoryFactory() ) ;
-        globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
+        pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ; 
+        return pm;
     }
 
-    /** Get the single instance of the PresentationManager
+    /**
+     * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific 
+     * AppContext to hold it. Creates and records one if needed.
      */
-    public static PresentationManager getPresentationManager()
+    public static PresentationManager getPresentationManager() 
     {
-        return globalPM ;
+        AppContext ac = AppContext.getAppContext();
+        PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class);
+        if (pm == null) {
+            pm = setupPresentationManager();
+            ac.put(PresentationManager.class, pm);
+        }
+        return pm;
     }
 
     /** Get the appropriate StubFactoryFactory.  This
@@ -240,8 +243,9 @@ public abstract class ORB extends com.su
     public static PresentationManager.StubFactoryFactory
         getStubFactoryFactory()
     {
-        boolean useDynamicStubs = globalPM.useDynamicStubs() ;
-        return globalPM.getStubFactoryFactory( useDynamicStubs ) ;
+        PresentationManager gPM = getPresentationManager();
+        boolean useDynamicStubs = gPM.useDynamicStubs() ;
+        return gPM.getStubFactoryFactory( useDynamicStubs ) ;
     }
 
     protected ORB()