equal
deleted
inserted
replaced
136 */ |
136 */ |
137 public class Activation implements Serializable { |
137 public class Activation implements Serializable { |
138 |
138 |
139 /** indicate compatibility with JDK 1.2 version of class */ |
139 /** indicate compatibility with JDK 1.2 version of class */ |
140 private static final long serialVersionUID = 2921265612698155191L; |
140 private static final long serialVersionUID = 2921265612698155191L; |
141 |
|
142 private static final byte MAJOR_VERSION = 1; |
141 private static final byte MAJOR_VERSION = 1; |
143 private static final byte MINOR_VERSION = 0; |
142 private static final byte MINOR_VERSION = 0; |
144 |
143 |
145 /** exec policy object */ |
144 /** exec policy object */ |
146 private static Object execPolicy; |
145 private static Object execPolicy; |
296 } |
295 } |
297 |
296 |
298 private static class SystemRegistryImpl extends RegistryImpl { |
297 private static class SystemRegistryImpl extends RegistryImpl { |
299 |
298 |
300 private static final String NAME = ActivationSystem.class.getName(); |
299 private static final String NAME = ActivationSystem.class.getName(); |
|
300 private static final long serialVersionUID = 4877330021609408794L; |
301 private final ActivationSystem systemStub; |
301 private final ActivationSystem systemStub; |
302 |
302 |
303 SystemRegistryImpl(int port, |
303 SystemRegistryImpl(int port, |
304 RMIClientSocketFactory csf, |
304 RMIClientSocketFactory csf, |
305 RMIServerSocketFactory ssf, |
305 RMIServerSocketFactory ssf, |
802 private static final int TERMINATING = 3; |
802 private static final int TERMINATING = 3; |
803 |
803 |
804 ActivationGroupDesc desc = null; |
804 ActivationGroupDesc desc = null; |
805 ActivationGroupID groupID = null; |
805 ActivationGroupID groupID = null; |
806 long incarnation = 0; |
806 long incarnation = 0; |
807 Map<ActivationID,ObjectEntry> objects = |
807 Map<ActivationID,ObjectEntry> objects = new HashMap<>(); |
808 new HashMap<ActivationID,ObjectEntry>(); |
808 Set<ActivationID> restartSet = new HashSet<>(); |
809 Set<ActivationID> restartSet = new HashSet<ActivationID>(); |
|
810 |
809 |
811 transient ActivationInstantiator group = null; |
810 transient ActivationInstantiator group = null; |
812 transient int status = NORMAL; |
811 transient int status = NORMAL; |
813 transient long waitTime = 0; |
812 transient long waitTime = 0; |
814 transient String groupName = null; |
813 transient String groupName = null; |
1055 waitTime = System.currentTimeMillis() + groupTimeout; |
1054 waitTime = System.currentTimeMillis() + groupTimeout; |
1056 notifyAll(); |
1055 notifyAll(); |
1057 } |
1056 } |
1058 } |
1057 } |
1059 |
1058 |
|
1059 /* |
|
1060 * Fallthrough from TERMINATE to TERMINATING |
|
1061 * is intentional |
|
1062 */ |
|
1063 @SuppressWarnings("fallthrough") |
1060 private void await() { |
1064 private void await() { |
1061 while (true) { |
1065 while (true) { |
1062 switch (status) { |
1066 switch (status) { |
1063 case NORMAL: |
1067 case NORMAL: |
1064 return; |
1068 return; |
1226 |
1230 |
1227 // handle child I/O streams before writing to child |
1231 // handle child I/O streams before writing to child |
1228 PipeWriter.plugTogetherPair |
1232 PipeWriter.plugTogetherPair |
1229 (child.getInputStream(), System.out, |
1233 (child.getInputStream(), System.out, |
1230 child.getErrorStream(), System.err); |
1234 child.getErrorStream(), System.err); |
1231 |
1235 try (MarshalOutputStream out = |
1232 MarshalOutputStream out = |
1236 new MarshalOutputStream(child.getOutputStream())) { |
1233 new MarshalOutputStream(child.getOutputStream()); |
1237 out.writeObject(id); |
1234 out.writeObject(id); |
1238 out.writeObject(desc); |
1235 out.writeObject(desc); |
1239 out.writeLong(incarnation); |
1236 out.writeLong(incarnation); |
1240 out.flush(); |
1237 out.flush(); |
1241 } |
1238 out.close(); |
|
1239 |
1242 |
1240 |
1243 |
1241 } catch (IOException e) { |
1244 } catch (IOException e) { |
1242 terminate(); |
1245 terminate(); |
1243 throw new ActivationException( |
1246 throw new ActivationException( |
1350 private String[] activationArgs(ActivationGroupDesc desc) { |
1353 private String[] activationArgs(ActivationGroupDesc desc) { |
1351 ActivationGroupDesc.CommandEnvironment cmdenv; |
1354 ActivationGroupDesc.CommandEnvironment cmdenv; |
1352 cmdenv = desc.getCommandEnvironment(); |
1355 cmdenv = desc.getCommandEnvironment(); |
1353 |
1356 |
1354 // argv is the literal command to exec |
1357 // argv is the literal command to exec |
1355 List<String> argv = new ArrayList<String>(); |
1358 List<String> argv = new ArrayList<>(); |
1356 |
1359 |
1357 // Command name/path |
1360 // Command name/path |
1358 argv.add((cmdenv != null && cmdenv.getCommandPath() != null) |
1361 argv.add((cmdenv != null && cmdenv.getCommandPath() != null) |
1359 ? cmdenv.getCommandPath() |
1362 ? cmdenv.getCommandPath() |
1360 : command[0]); |
1363 : command[0]); |
1955 "rmid.inherited.channel.info") + |
1958 "rmid.inherited.channel.info") + |
1956 ": " + inheritedChannel); |
1959 ": " + inheritedChannel); |
1957 } |
1960 } |
1958 |
1961 |
1959 String log = null; |
1962 String log = null; |
1960 List<String> childArgs = new ArrayList<String>(); |
1963 List<String> childArgs = new ArrayList<>(); |
1961 |
1964 |
1962 /* |
1965 /* |
1963 * Parse arguments |
1966 * Parse arguments |
1964 */ |
1967 */ |
1965 for (int i = 0; i < args.length; i++) { |
1968 for (int i = 0; i < args.length; i++) { |
2029 { |
2032 { |
2030 execPolicyClassName = DefaultExecPolicy.class.getName(); |
2033 execPolicyClassName = DefaultExecPolicy.class.getName(); |
2031 } |
2034 } |
2032 |
2035 |
2033 try { |
2036 try { |
2034 Class<?> execPolicyClass = |
2037 Class<?> execPolicyClass = getRMIClass(execPolicyClassName); |
2035 RMIClassLoader.loadClass(execPolicyClassName); |
|
2036 execPolicy = execPolicyClass.newInstance(); |
2038 execPolicy = execPolicyClass.newInstance(); |
2037 execPolicyMethod = |
2039 execPolicyMethod = |
2038 execPolicyClass.getMethod("checkExecCommand", |
2040 execPolicyClass.getMethod("checkExecCommand", |
2039 ActivationGroupDesc.class, |
2041 ActivationGroupDesc.class, |
2040 String[].class); |
2042 String[].class); |
2121 } else { |
2123 } else { |
2122 return val; |
2124 return val; |
2123 } |
2125 } |
2124 } |
2126 } |
2125 |
2127 |
|
2128 @SuppressWarnings("deprecation") |
|
2129 private static Class<?> getRMIClass(String execPolicyClassName) throws Exception { |
|
2130 return RMIClassLoader.loadClass(execPolicyClassName); |
|
2131 } |
2126 /* |
2132 /* |
2127 * Dijkstra semaphore operations to limit the number of subprocesses |
2133 * Dijkstra semaphore operations to limit the number of subprocesses |
2128 * rmid attempts to make at once. |
2134 * rmid attempts to make at once. |
2129 */ |
2135 */ |
2130 /** |
2136 /** |