Java 类java.rmi.activation.ActivationGroup 实例源码

项目:freeVM    文件:TestActivationGroup.java   
public final void testGetSystem001() {
        SecurityManager smOld = System.getSecurityManager();
        try{
            SecurityManager sm = new SecurityManager() {
                boolean allow = false;
                public void checkPermission(Permission perm) {
                    if (!allow) {
                        allow= true;
                      //  throw new SecurityException("No, No, No, you can't do that.");
                    }
                }
            };
            System.setSecurityManager(sm);      
            ActivationGroup.getSystem();
        //} catch (ActivationException e) {             
        } catch (Throwable e) {
            fail(msgNoException+e);

    } finally {
        System.setSecurityManager(smOld);
    }        
}
项目:OpenJSharp    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:jdk8u-jdk    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:openjdk-jdk10    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:openjdk9    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:jdk8u_jdk    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:infobip-open-jdk-8    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:jdk8u-dev-jdk    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:jdk7-jdk    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:openjdk-source-code-learn    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:OLD-OpenJDK8    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:cn1    文件:ActivationGroupImpl.java   
/**
 * This main method is used to start new VMs for ActivationGroups. Four
 * parameters needed to create ActivationGroup are: <br>
 * ActivationGroupID <br>
 * ActivationGroupDesc <br>
 * incarnation The parameters needed to create ActivationGroup correctly are
 * passed through the standard input stream in the following order: <br>
 * ActivationGroupID -> ActivationGroupDesc -> incarnation
 */
public static void main(String args[]) {
    // rmi.log.4C=ActivationGroupImpl.main:
    rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.4C")); //$NON-NLS-1$
    if (System.getSecurityManager() == null) {
        System.setSecurityManager(new RMISecurityManager());
    }

    try {
        // rmi.log.4F=System.in.available = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.4F", //$NON-NLS-1$
                System.in.available()));

        RMIObjectInputStream ois = new RMIObjectInputStream(
                new BufferedInputStream(System.in));
        // rmi.log.55=ois = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.55", ois)); //$NON-NLS-1$
        ActivationGroupID agid = (ActivationGroupID) ois.readObject();
        // rmi.log.57=agid = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.57", agid)); //$NON-NLS-1$
        ActivationGroupDesc agdesc = (ActivationGroupDesc) ois.readObject();
        // rmi.log.74=agdesc = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.74", agdesc)); //$NON-NLS-1$
        long incarnation = ois.readLong();
        // rmi.log.7B=incarnation = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.7B", incarnation)); //$NON-NLS-1$
        ActivationGroup.createGroup(agid, agdesc, incarnation);
    } catch (Throwable t) {
        // rmi.log.7C=: Exception: {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.7C", t)); //$NON-NLS-1$
        t.printStackTrace();
    }
}
项目:cn1    文件:ActivationGroupTest.java   
/**
 * Tests if getSystem() method successfully returns if this system was previously
 * set to a proxy value (which is possible in real application when dynamic remote
 * stub is created for it) - regression test for HARMONY-1970.
 */
public void testGetSystemProxyObj() throws Exception {
    ActivationSystem system = (ActivationSystem) Proxy.newProxyInstance(null,
            new Class[] { ActivationSystem.class }, new TestInvocationHandler());
    ActivationGroup.setSystem(system);
    ActivationGroup.getSystem();
}
项目:cn1    文件:StartupShutdownTest.java   
public void testStartup() throws Exception {
    SubProcess rmid = JavaInvoker.invokeSimilar((String[]) null,
            "org.apache.harmony.rmi.activation.Rmid", (String[]) null, true, true);
    rmid.pipeError();
    rmid.pipeInput();
    rmid.closeOutput();
    Thread.sleep(5000);
    ActivationSystem as = ActivationGroup.getSystem();
    assertNotNull(as);
    rmid.destroy();
}
项目:cn1    文件:DefaultParamTest.java   
public void testSimpleInstall() throws Exception {
    try {
        Properties props = new Properties();
        ActivationGroupDesc groupDesc = new ActivationGroupDesc(props, null);

        System.out.println("groupDesc = " + groupDesc);

        System.out.flush();
        ActivationSystem as = ActivationGroup.getSystem();

        System.out.println("ActivationSystem = " + as);

        ActivationGroupID groupID = as.registerGroup(groupDesc);
        System.out.println("groupID = " + groupID);
        System.out.println("Activation group descriptor registered.");

        MarshalledObject data = new MarshalledObject("HelloImpl");
        System.out.println("MarshalledObject data = " + data);

        ActivationDesc desc = new ActivationDesc(groupID, "org.apache.harmony.rmi.tests.java.rmi.activation.HelloImpl", "", null);
        System.out.println("Registering ActivationDesc:");
        Remote stub = Activatable.register(desc);
        System.out.println("Activation descriptor registered: " + stub);

        Registry reg = LocateRegistry.getRegistry();
        System.out.println("Registry = " + reg);

        reg.rebind("HelloImpl_Stub", stub);
        System.out.println("Stub bound in registry.");
    } catch (Throwable t) {
        System.out.println("Exception in HelloInstaller: " + t);
        t.printStackTrace();
        fail("Exception in HelloInstaller: " + t);
    }
}
项目:openjdk-jdk7u-jdk    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:freeVM    文件:ActivationGroupImpl.java   
/**
 * This main method is used to start new VMs for ActivationGroups. Four
 * parameters needed to create ActivationGroup are: <br>
 * ActivationGroupID <br>
 * ActivationGroupDesc <br>
 * incarnation The parameters needed to create ActivationGroup correctly are
 * passed through the standard input stream in the following order: <br>
 * ActivationGroupID -> ActivationGroupDesc -> incarnation
 */
public static void main(String args[]) {
    // rmi.log.4C=ActivationGroupImpl.main:
    rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.4C")); //$NON-NLS-1$
    if (System.getSecurityManager() == null) {
        System.setSecurityManager(new RMISecurityManager());
    }

    try {
        // rmi.log.4F=System.in.available = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.4F", //$NON-NLS-1$
                System.in.available()));

        RMIObjectInputStream ois = new RMIObjectInputStream(
                new BufferedInputStream(System.in));
        // rmi.log.55=ois = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.55", ois)); //$NON-NLS-1$
        ActivationGroupID agid = (ActivationGroupID) ois.readObject();
        // rmi.log.57=agid = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.57", agid)); //$NON-NLS-1$
        ActivationGroupDesc agdesc = (ActivationGroupDesc) ois.readObject();
        // rmi.log.74=agdesc = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.74", agdesc)); //$NON-NLS-1$
        long incarnation = ois.readLong();
        // rmi.log.7B=incarnation = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.7B", incarnation)); //$NON-NLS-1$
        ActivationGroup.createGroup(agid, agdesc, incarnation);
    } catch (Throwable t) {
        // rmi.log.7C=: Exception: {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.7C", t)); //$NON-NLS-1$
        t.printStackTrace();
    }
}
项目:freeVM    文件:ActivationGroupTest.java   
/**
 * Tests if getSystem() method successfully returns if this system was previously
 * set to a proxy value (which is possible in real application when dynamic remote
 * stub is created for it) - regression test for HARMONY-1970.
 */
public void testGetSystemProxyObj() throws Exception {
    ActivationSystem system = (ActivationSystem) Proxy.newProxyInstance(null,
            new Class[] { ActivationSystem.class }, new TestInvocationHandler());
    ActivationGroup.setSystem(system);
    ActivationGroup.getSystem();
}
项目:freeVM    文件:StartupShutdownTest.java   
public void testStartup() throws Exception {
    SubProcess rmid = JavaInvoker.invokeSimilar((String[]) null,
            "org.apache.harmony.rmi.activation.Rmid", (String[]) null, true, true);
    rmid.pipeError();
    rmid.pipeInput();
    rmid.closeOutput();
    Thread.sleep(5000);
    ActivationSystem as = ActivationGroup.getSystem();
    assertNotNull(as);
    rmid.destroy();
}
项目:freeVM    文件:DefaultParamTest.java   
public void testSimpleInstall() throws Exception {
    try {
        Properties props = new Properties();
        ActivationGroupDesc groupDesc = new ActivationGroupDesc(props, null);

        System.out.println("groupDesc = " + groupDesc);

        System.out.flush();
        ActivationSystem as = ActivationGroup.getSystem();

        System.out.println("ActivationSystem = " + as);

        ActivationGroupID groupID = as.registerGroup(groupDesc);
        System.out.println("groupID = " + groupID);
        System.out.println("Activation group descriptor registered.");

        MarshalledObject data = new MarshalledObject("HelloImpl");
        System.out.println("MarshalledObject data = " + data);

        ActivationDesc desc = new ActivationDesc(groupID, "org.apache.harmony.rmi.tests.java.rmi.activation.HelloImpl", "", null);
        System.out.println("Registering ActivationDesc:");
        Remote stub = Activatable.register(desc);
        System.out.println("Activation descriptor registered: " + stub);

        Registry reg = LocateRegistry.getRegistry();
        System.out.println("Registry = " + reg);

        reg.rebind("HelloImpl_Stub", stub);
        System.out.println("Stub bound in registry.");
    } catch (Throwable t) {
        System.out.println("Exception in HelloInstaller: " + t);
        t.printStackTrace();
        fail("Exception in HelloInstaller: " + t);
    }
}
项目:freeVM    文件:ActivationGroupImpl.java   
/**
 * This main method is used to start new VMs for ActivationGroups. Four
 * parameters needed to create ActivationGroup are: <br>
 * ActivationGroupID <br>
 * ActivationGroupDesc <br>
 * incarnation The parameters needed to create ActivationGroup correctly are
 * passed through the standard input stream in the following order: <br>
 * ActivationGroupID -> ActivationGroupDesc -> incarnation
 */
public static void main(String args[]) {
    // rmi.log.4C=ActivationGroupImpl.main:
    rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.4C")); //$NON-NLS-1$
    if (System.getSecurityManager() == null) {
        System.setSecurityManager(new RMISecurityManager());
    }

    try {
        // rmi.log.4F=System.in.available = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.4F", //$NON-NLS-1$
                System.in.available()));

        RMIObjectInputStream ois = new RMIObjectInputStream(
                new BufferedInputStream(System.in));
        // rmi.log.55=ois = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.55", ois)); //$NON-NLS-1$
        ActivationGroupID agid = (ActivationGroupID) ois.readObject();
        // rmi.log.57=agid = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.57", agid)); //$NON-NLS-1$
        ActivationGroupDesc agdesc = (ActivationGroupDesc) ois.readObject();
        // rmi.log.74=agdesc = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.74", agdesc)); //$NON-NLS-1$
        long incarnation = ois.readLong();
        // rmi.log.7B=incarnation = {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.7B", incarnation)); //$NON-NLS-1$
        ActivationGroup.createGroup(agid, agdesc, incarnation);
    } catch (Throwable t) {
        // rmi.log.7C=: Exception: {0}
        rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.7C", t)); //$NON-NLS-1$
        t.printStackTrace();
    }
}
项目:freeVM    文件:ActivationGroupTest.java   
/**
 * Tests if getSystem() method successfully returns if this system was previously
 * set to a proxy value (which is possible in real application when dynamic remote
 * stub is created for it) - regression test for HARMONY-1970.
 */
public void testGetSystemProxyObj() throws Exception {
    ActivationSystem system = (ActivationSystem) Proxy.newProxyInstance(null,
            new Class[] { ActivationSystem.class }, new TestInvocationHandler());
    ActivationGroup.setSystem(system);
    ActivationGroup.getSystem();
}
项目:freeVM    文件:StartupShutdownTest.java   
public void testStartup() throws Exception {
    SubProcess rmid = JavaInvoker.invokeSimilar((String[]) null,
            "org.apache.harmony.rmi.activation.Rmid", (String[]) null, true, true);
    rmid.pipeError();
    rmid.pipeInput();
    rmid.closeOutput();
    Thread.sleep(5000);
    ActivationSystem as = ActivationGroup.getSystem();
    assertNotNull(as);
    rmid.destroy();
}
项目:freeVM    文件:DefaultParamTest.java   
public void testSimpleInstall() throws Exception {
    try {
        Properties props = new Properties();
        ActivationGroupDesc groupDesc = new ActivationGroupDesc(props, null);

        System.out.println("groupDesc = " + groupDesc);

        System.out.flush();
        ActivationSystem as = ActivationGroup.getSystem();

        System.out.println("ActivationSystem = " + as);

        ActivationGroupID groupID = as.registerGroup(groupDesc);
        System.out.println("groupID = " + groupID);
        System.out.println("Activation group descriptor registered.");

        MarshalledObject data = new MarshalledObject("HelloImpl");
        System.out.println("MarshalledObject data = " + data);

        ActivationDesc desc = new ActivationDesc(groupID, "org.apache.harmony.rmi.tests.java.rmi.activation.HelloImpl", "", null);
        System.out.println("Registering ActivationDesc:");
        Remote stub = Activatable.register(desc);
        System.out.println("Activation descriptor registered: " + stub);

        Registry reg = LocateRegistry.getRegistry();
        System.out.println("Registry = " + reg);

        reg.rebind("HelloImpl_Stub", stub);
        System.out.println("Stub bound in registry.");
    } catch (Throwable t) {
        System.out.println("Exception in HelloInstaller: " + t);
        t.printStackTrace();
        fail("Exception in HelloInstaller: " + t);
    }
}
项目:openjdk-icedtea7    文件:ActivationGroupInit.java   
/**
 * 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
        }
    }
}
项目:jdk8u-jdk    文件:RmidViaInheritedChannel.java   
public static void main(String[] args) throws Exception {
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;

    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new RmidViaInheritedChannel();
        Callback proxy = (Callback)
            UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, false,
                               TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
        if (System.getProperty("os.name").startsWith("Windows") &&
            System.getProperty("os.version").startsWith("5."))
        {
            /* Windows XP/2003 or older
             * Need to expand ephemeral range to include RMI test ports
             */
            rmid.addOptions(new String[]{
                "-Djdk.net.ephemeralPortRange.low=1024",
                "-Djdk.net.ephemeralPortRange.high=64000"
            });
        }
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");

    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}
项目:jdk8u-jdk    文件:InheritedChannelNotServerSocket.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 6261402\n");
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;
    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new CallbackImpl();
        Callback proxy =
            (Callback) UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, true,
                               TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=" +
            "InheritedChannelNotServerSocket$SP"});
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");
    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}
项目:openjdk-jdk10    文件:InheritedChannelNotServerSocket.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 6261402\n");
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;
    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new CallbackImpl();
        Callback proxy =
            (Callback) UnicastRemoteObject.exportObject(obj, 0);
        Registry registry = TestLibrary.createRegistryOnEphemeralPort();
        int registryPort = TestLibrary.getRegistryPort(registry);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, true,
                               TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
        rmid.addOptions(
            "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
            "-Djava.nio.channels.spi.SelectorProvider=InheritedChannelNotServerSocket$SP",
            "-Dtest.java.rmi.rmidViaInheritedChannel.registry.port=" + registryPort);
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");
    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        if (rmid != null) {
            rmid.cleanup();
        }
    }
}
项目:openjdk-jdk10    文件:DownloadActivationGroup.java   
public static void main(String[] args) {

        RMID rmid = null;

        System.out.println("\nRegression test for bug 4510355\n");

        try {
            TestLibrary.suggestSecurityManager("java.lang.SecurityManager");

            /*
             * Install group class file in codebase.
             */
            System.err.println("install class file in codebase");
            URL groupURL = TestLibrary.installClassInCodebase(
                                  "MyActivationGroupImpl", "group");
            System.err.println("class file installed");

            /*
             * Start rmid.
             */
            RMID.removeLog();
            rmid = RMID.createRMIDOnEphemeralPort();
            String execPolicyOption = "-Dsun.rmi.activation.execPolicy=none";
            rmid.addOptions(new String[] { execPolicyOption });
            rmid.start();

            /*
             * Create and register descriptors for custom group and an
             * activatable object in that group.
             */
            System.err.println("register group");

            Properties p = new Properties();
            p.put("java.security.policy", TestParams.defaultGroupPolicy);
            CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(
                    null,
                    new String[] {
                        "--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED",
                        "--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED",
                        "--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED",
                        "--add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });

            ActivationGroupDesc groupDesc =
                new ActivationGroupDesc("MyActivationGroupImpl",
                                        groupURL.toExternalForm(),
                                        null, p, cmd);
            ActivationGroupID groupID =
                ActivationGroup.getSystem().registerGroup(groupDesc);


            System.err.println("register activatable object");
            ActivationDesc desc =
                new ActivationDesc(groupID, "DownloadActivationGroup",
                                   null, null);
            Ping obj = (Ping) Activatable.register(desc);

            /*
             * Start group (by calling ping).
             */
            System.err.println(
                "ping object (forces download of group's class)");
            obj.ping();
            System.err.println(
                "TEST PASSED: group's class downloaded successfully");
            System.err.println("shutdown object");
            obj.shutdown();
            System.err.println("TEST PASSED");

        } catch (Exception e) {
            TestLibrary.bomb(e);
        } finally {
            rmid.cleanup();
        }
    }
项目:openjdk9    文件:RmidViaInheritedChannel.java   
public static void main(String[] args) throws Exception {
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;

    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new RmidViaInheritedChannel();
        Callback proxy = (Callback)
            UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, false,
                               TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
        rmid.addOptions(
            "-XaddExports:java.base/sun.nio.ch=ALL-UNNAMED",
            "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider");
        if (System.getProperty("os.name").startsWith("Windows") &&
            System.getProperty("os.version").startsWith("5."))
        {
            /* Windows XP/2003 or older
             * Need to expand ephemeral range to include RMI test ports
             */
            rmid.addOptions(new String[]{
                "-Djdk.net.ephemeralPortRange.low=1024",
                "-Djdk.net.ephemeralPortRange.high=64000"
            });
        }
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");

    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        if (rmid != null) {
            rmid.cleanup();
        }
    }
}
项目:openjdk9    文件:InheritedChannelNotServerSocket.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 6261402\n");
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;
    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new CallbackImpl();
        Callback proxy =
            (Callback) UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, true,
                               TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
        rmid.addOptions(
            "-XaddExports:java.base/sun.nio.ch=ALL-UNNAMED",
            "-Djava.nio.channels.spi.SelectorProvider=InheritedChannelNotServerSocket$SP");
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");
    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        if (rmid != null) {
            rmid.cleanup();
        }
    }
}
项目:openjdk9    文件:DownloadActivationGroup.java   
public static void main(String[] args) {

        RMID rmid = null;

        System.out.println("\nRegression test for bug 4510355\n");

        try {
            TestLibrary.suggestSecurityManager("java.lang.SecurityManager");

            /*
             * Install group class file in codebase.
             */
            System.err.println("install class file in codebase");
            URL groupURL = TestLibrary.installClassInCodebase(
                                  "MyActivationGroupImpl", "group");
            System.err.println("class file installed");

            /*
             * Start rmid.
             */
            RMID.removeLog();
            rmid = RMID.createRMID();
            String execPolicyOption = "-Dsun.rmi.activation.execPolicy=none";
            rmid.addOptions(new String[] { execPolicyOption });
            rmid.start();

            /*
             * Create and register descriptors for custom group and an
             * activatable object in that group.
             */
            System.err.println("register group");

            Properties p = new Properties();
            p.put("java.security.policy", TestParams.defaultGroupPolicy);
            CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(
                    null,
                    new String[] {
                        "-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED",
                        "-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED",
                        "-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED",
                        "-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });

            ActivationGroupDesc groupDesc =
                new ActivationGroupDesc("MyActivationGroupImpl",
                                        groupURL.toExternalForm(),
                                        null, p, cmd);
            ActivationGroupID groupID =
                ActivationGroup.getSystem().registerGroup(groupDesc);


            System.err.println("register activatable object");
            ActivationDesc desc =
                new ActivationDesc(groupID, "DownloadActivationGroup",
                                   null, null);
            Ping obj = (Ping) Activatable.register(desc);

            /*
             * Start group (by calling ping).
             */
            System.err.println(
                "ping object (forces download of group's class)");
            obj.ping();
            System.err.println(
                "TEST PASSED: group's class downloaded successfully");
            System.err.println("shutdown object");
            obj.shutdown();
            System.err.println("TEST PASSED");

        } catch (Exception e) {
            TestLibrary.bomb(e);
        } finally {
            rmid.cleanup();
        }
    }
项目:jdk8u_jdk    文件:RmidViaInheritedChannel.java   
public static void main(String[] args) throws Exception {
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;

    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new RmidViaInheritedChannel();
        Callback proxy = (Callback)
            UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, false,
                               TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
        if (System.getProperty("os.name").startsWith("Windows") &&
            System.getProperty("os.version").startsWith("5."))
        {
            /* Windows XP/2003 or older
             * Need to expand ephemeral range to include RMI test ports
             */
            rmid.addOptions(new String[]{
                "-Djdk.net.ephemeralPortRange.low=1024",
                "-Djdk.net.ephemeralPortRange.high=64000"
            });
        }
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");

    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}
项目:jdk8u_jdk    文件:InheritedChannelNotServerSocket.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 6261402\n");
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;
    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new CallbackImpl();
        Callback proxy =
            (Callback) UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, true,
                               TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=" +
            "InheritedChannelNotServerSocket$SP"});
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");
    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:RmidViaInheritedChannel.java   
public static void main(String[] args) throws Exception {
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;

    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new RmidViaInheritedChannel();
        Callback proxy = (Callback)
            UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, false,
                               TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
        if (System.getProperty("os.name").startsWith("Windows") &&
            System.getProperty("os.version").startsWith("5."))
        {
            /* Windows XP/2003 or older
             * Need to expand ephemeral range to include RMI test ports
             */
            rmid.addOptions(new String[]{
                "-Djdk.net.ephemeralPortRange.low=1024",
                "-Djdk.net.ephemeralPortRange.high=64000"
            });
        }
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");

    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:InheritedChannelNotServerSocket.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 6261402\n");
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;
    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new CallbackImpl();
        Callback proxy =
            (Callback) UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, true,
                               TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=" +
            "InheritedChannelNotServerSocket$SP"});
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");
    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}
项目:infobip-open-jdk-8    文件:RmidViaInheritedChannel.java   
public static void main(String[] args) throws Exception {
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;

    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new RmidViaInheritedChannel();
        Callback proxy = (Callback)
            UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, false,
                               TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
        if (System.getProperty("os.name").startsWith("Windows") &&
            System.getProperty("os.version").startsWith("5."))
        {
            /* Windows XP/2003 or older
             * Need to expand ephemeral range to include RMI test ports
             */
            rmid.addOptions(new String[]{
                "-Djdk.net.ephemeralPortRange.low=1024",
                "-Djdk.net.ephemeralPortRange.high=64000"
            });
        }
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");

    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}
项目:infobip-open-jdk-8    文件:InheritedChannelNotServerSocket.java   
public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 6261402\n");
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;
    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new CallbackImpl();
        Callback proxy =
            (Callback) UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, true,
                               TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=" +
            "InheritedChannelNotServerSocket$SP"});
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");
    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}
项目:jdk8u-dev-jdk    文件:RmidViaInheritedChannel.java   
public static void main(String[] args) throws Exception {
    System.setProperty("java.rmi.activation.port",
                       Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;

    try {
        /*
         * Export callback object and bind in registry.
         */
        System.err.println("export callback object and bind in registry");
        obj = new RmidViaInheritedChannel();
        Callback proxy = (Callback)
            UnicastRemoteObject.exportObject(obj, 0);
        Registry registry =
            LocateRegistry.createRegistry(
                TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
        registry.bind("Callback", proxy);

        /*
         * Start rmid.
         */
        System.err.println("start rmid with inherited channel");
        RMID.removeLog();
        rmid = RMID.createRMID(System.out, System.err, true, false,
                               TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
        rmid.addOptions(new String[]{
            "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
        if (System.getProperty("os.name").startsWith("Windows") &&
            System.getProperty("os.version").startsWith("5."))
        {
            /* Windows XP/2003 or older
             * Need to expand ephemeral range to include RMI test ports
             */
            rmid.addOptions(new String[]{
                "-Djdk.net.ephemeralPortRange.low=1024",
                "-Djdk.net.ephemeralPortRange.high=64000"
            });
        }
        rmid.start();

        /*
         * Get activation system and wait to be notified via callback
         * from rmid's selector provider.
         */
        System.err.println("get activation system");
        ActivationSystem system = ActivationGroup.getSystem();
        System.err.println("ActivationSystem = " + system);
        synchronized (lock) {
            while (!notified) {
                lock.wait();
            }
        }
        System.err.println("TEST PASSED");

    } finally {
        if (obj != null) {
            UnicastRemoteObject.unexportObject(obj, true);
        }
        ActivationLibrary.rmidCleanup(rmid);
    }
}