equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2013, 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 |
59 import java.rmi.server.RemoteObjectInvocationHandler; |
59 import java.rmi.server.RemoteObjectInvocationHandler; |
60 import java.rmi.server.RemoteRef; |
60 import java.rmi.server.RemoteRef; |
61 import java.security.AccessController; |
61 import java.security.AccessController; |
62 import java.security.PrivilegedAction; |
62 import java.security.PrivilegedAction; |
63 import java.security.PrivilegedExceptionAction; |
63 import java.security.PrivilegedExceptionAction; |
|
64 import java.security.PrivilegedActionException; |
64 import java.security.ProtectionDomain; |
65 import java.security.ProtectionDomain; |
65 import java.util.Arrays; |
66 import java.util.Arrays; |
66 import java.util.Collections; |
67 import java.util.Collections; |
67 import java.util.HashMap; |
68 import java.util.HashMap; |
68 import java.util.Map; |
69 import java.util.Map; |
126 |
127 |
127 private RMIConnector(RMIServer rmiServer, JMXServiceURL address, |
128 private RMIConnector(RMIServer rmiServer, JMXServiceURL address, |
128 Map<String, ?> environment) { |
129 Map<String, ?> environment) { |
129 if (rmiServer == null && address == null) throw new |
130 if (rmiServer == null && address == null) throw new |
130 IllegalArgumentException("rmiServer and jmxServiceURL both null"); |
131 IllegalArgumentException("rmiServer and jmxServiceURL both null"); |
131 |
|
132 initTransients(); |
132 initTransients(); |
133 |
133 |
134 this.rmiServer = rmiServer; |
134 this.rmiServer = rmiServer; |
135 this.jmxServiceURL = address; |
135 this.jmxServiceURL = address; |
136 if (environment == null) { |
136 if (environment == null) { |
2368 } else { |
2368 } else { |
2369 proxyStubClass = null; |
2369 proxyStubClass = null; |
2370 } |
2370 } |
2371 } |
2371 } |
2372 |
2372 |
2373 private static RMIConnection shadowIiopStub(Object stub) |
2373 private static RMIConnection shadowIiopStub(Object stub) |
2374 throws InstantiationException, IllegalAccessException { |
2374 throws InstantiationException, IllegalAccessException { |
2375 Object proxyStub = proxyStubClass.newInstance(); |
2375 Object proxyStub = null; |
|
2376 try { |
|
2377 proxyStub = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { |
|
2378 public Object run() throws Exception { |
|
2379 return proxyStubClass.newInstance(); |
|
2380 } |
|
2381 }); |
|
2382 } catch (PrivilegedActionException e) { |
|
2383 throw new InternalError(); |
|
2384 } |
2376 IIOPHelper.setDelegate(proxyStub, IIOPHelper.getDelegate(stub)); |
2385 IIOPHelper.setDelegate(proxyStub, IIOPHelper.getDelegate(stub)); |
2377 return (RMIConnection) proxyStub; |
2386 return (RMIConnection) proxyStub; |
2378 } |
2387 } |
2379 |
|
2380 private static RMIConnection getConnection(RMIServer server, |
2388 private static RMIConnection getConnection(RMIServer server, |
2381 Object credentials, |
2389 Object credentials, |
2382 boolean checkStub) |
2390 boolean checkStub) |
2383 throws IOException { |
2391 throws IOException { |
2384 RMIConnection c = server.newClient(credentials); |
2392 RMIConnection c = server.newClient(credentials); |