use of java.rmi.activation.ActivationGroupDesc in project jdk8u_jdk by JetBrains.
the class PipeWriter method activationArgs.
private String[] activationArgs(ActivationGroupDesc desc) {
ActivationGroupDesc.CommandEnvironment cmdenv;
cmdenv = desc.getCommandEnvironment();
// argv is the literal command to exec
List<String> argv = new ArrayList<>();
// Command name/path
argv.add((cmdenv != null && cmdenv.getCommandPath() != null) ? cmdenv.getCommandPath() : command[0]);
// Group-specific command options
if (cmdenv != null && cmdenv.getCommandOptions() != null) {
argv.addAll(Arrays.asList(cmdenv.getCommandOptions()));
}
// Properties become -D parameters
Properties props = desc.getPropertyOverrides();
if (props != null) {
for (Enumeration<?> p = props.propertyNames(); p.hasMoreElements(); ) {
String name = (String) p.nextElement();
/* Note on quoting: it would be wrong
* here, since argv will be passed to
* Runtime.exec, which should not parse
* arguments or split on whitespace.
*/
argv.add("-D" + name + "=" + props.getProperty(name));
}
}
/* Finally, rmid-global command options (e.g. -C options)
* and the classname
*/
for (int i = 1; i < command.length; i++) {
argv.add(command[i]);
}
String[] realArgv = new String[argv.size()];
System.arraycopy(argv.toArray(), 0, realArgv, 0, realArgv.length);
return realArgv;
}
use of java.rmi.activation.ActivationGroupDesc in project jdk8u_jdk by JetBrains.
the class ActivationGroupInit method main.
/**
* Main program to start a VM for an activation group.
*/
public static void main(String[] args) {
try {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
// read group id, descriptor, and incarnation number from stdin
MarshalInputStream in = new MarshalInputStream(System.in);
ActivationGroupID id = (ActivationGroupID) in.readObject();
ActivationGroupDesc desc = (ActivationGroupDesc) in.readObject();
long incarnation = in.readLong();
// create and set group for the VM
ActivationGroup.createGroup(id, desc, incarnation);
} catch (Exception e) {
System.err.println("Exception in starting ActivationGroupInit:");
e.printStackTrace();
} finally {
try {
System.in.close();
// note: system out/err shouldn't be closed
// since the parent may want to read them.
} catch (Exception ex) {
// ignore exceptions
}
}
}
use of java.rmi.activation.ActivationGroupDesc in project jdk8u_jdk by JetBrains.
the class IdempotentActiveGroup method main.
public static void main(String[] args) {
System.err.println("\nRegression test for bug 4720528\n");
TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
RMID rmid = null;
ActivationInstantiator inst1 = null;
ActivationInstantiator inst2 = null;
try {
RMID.removeLog();
rmid = RMID.createRMID();
rmid.start();
System.err.println("Create group descriptor");
ActivationGroupDesc groupDesc = new ActivationGroupDesc(null, null);
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("Register group descriptor");
ActivationGroupID groupID = system.registerGroup(groupDesc);
inst1 = new FakeInstantiator();
inst2 = new FakeInstantiator();
System.err.println("Invoke activeGroup with inst1");
system.activeGroup(groupID, inst1, 0);
try {
System.err.println("Invoke activeGroup with inst2");
system.activeGroup(groupID, inst2, 0);
throw new RuntimeException("TEST FAILED: activeGroup with unequal groups succeeded!");
} catch (ActivationException expected) {
System.err.println("Caught expected ActivationException");
System.err.println("Test 1 (of 2) passed");
}
try {
System.err.println("Invoke activeGroup with inst1");
system.activeGroup(groupID, inst1, 0);
System.err.println("activeGroup call succeeded");
System.err.println("Test 2 (of 2) passed");
} catch (ActivationException unexpected) {
throw new RuntimeException("TEST FAILED: activeGroup with equal groups failed!", unexpected);
}
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
try {
if (inst1 != null) {
UnicastRemoteObject.unexportObject(inst1, true);
}
if (inst2 != null) {
UnicastRemoteObject.unexportObject(inst2, true);
}
} catch (NoSuchObjectException unexpected) {
throw new AssertionError(unexpected);
}
ActivationLibrary.rmidCleanup(rmid);
}
}
Aggregations