当前位置: 首页>>代码示例>>Java>>正文


Java ActivationGroup类代码示例

本文整理汇总了Java中java.rmi.activation.ActivationGroup的典型用法代码示例。如果您正苦于以下问题:Java ActivationGroup类的具体用法?Java ActivationGroup怎么用?Java ActivationGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ActivationGroup类属于java.rmi.activation包,在下文中一共展示了ActivationGroup类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetSystem001

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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);
    }        
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:TestActivationGroup.java

示例2: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
/**
 * 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
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:ActivationGroupInit.java

示例3: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:42,代码来源:ActivationGroupImpl.java

示例4: testGetSystemProxyObj

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:ActivationGroupTest.java

示例5: testStartup

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:StartupShutdownTest.java

示例6: testSimpleInstall

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:36,代码来源:DefaultParamTest.java

示例7: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:63,代码来源:RmidViaInheritedChannel.java

示例8: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:52,代码来源:InheritedChannelNotServerSocket.java

示例9: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:InheritedChannelNotServerSocket.java

示例10: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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();
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:75,代码来源:DownloadActivationGroup.java

示例11: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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();
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:66,代码来源:RmidViaInheritedChannel.java

示例12: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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();
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:54,代码来源:InheritedChannelNotServerSocket.java

示例13: main

import java.rmi.activation.ActivationGroup; //导入依赖的package包/类
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();
        }
    }
 
开发者ID:campolake,项目名称:openjdk9,代码行数:75,代码来源:DownloadActivationGroup.java


注:本文中的java.rmi.activation.ActivationGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。