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

项目:openjdk-jdk10    文件:Activation.java   
/**
 * Waits for systemStub to be initialized and returns its
 * initialized value. Any remote call that uses systemStub must
 * call this method to get it instead of using direct field
 * access. This is necessary because the super() call in the
 * constructor exports this object before systemStub is initialized
 * (see JDK-8023541), allowing remote calls to come in during this
 * time. We can't use checkShutdown() like other nested classes
 * because this is a static class.
 */
private synchronized ActivationSystem getSystemStub() {
    boolean interrupted = false;

    while (systemStub == null) {
        try {
            wait();
        } catch (InterruptedException ie) {
            interrupted = true;
        }
    }

    if (interrupted) {
        Thread.currentThread().interrupt();
    }

    return systemStub;
}
项目:openjdk9    文件:Activation.java   
/**
 * Waits for systemStub to be initialized and returns its
 * initialized value. Any remote call that uses systemStub must
 * call this method to get it instead of using direct field
 * access. This is necessary because the super() call in the
 * constructor exports this object before systemStub is initialized
 * (see JDK-8023541), allowing remote calls to come in during this
 * time. We can't use checkShutdown() like other nested classes
 * because this is a static class.
 */
private synchronized ActivationSystem getSystemStub() {
    boolean interrupted = false;

    while (systemStub == null) {
        try {
            wait();
        } catch (InterruptedException ie) {
            interrupted = true;
        }
    }

    if (interrupted) {
        Thread.currentThread().interrupt();
    }

    return systemStub;
}
项目:OpenJSharp    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:jdk8u-jdk    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:openjdk-jdk10    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    assert systemStub != null;
    synchronized (this) {
        this.systemStub = systemStub;
        notifyAll();
    }
}
项目:openjdk9    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    assert systemStub != null;
    synchronized (this) {
        this.systemStub = systemStub;
        notifyAll();
    }
}
项目:jdk8u_jdk    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:lookaside_java-1.8.0-openjdk    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:javify    文件:ActivationSystemImpl.java   
/**
 * Obtain the singleton instance of this class.
 *
 * @param folder the folder, where the activation system will keep its files.
 * @param cold do the cold start if true, hot (usual) if false.
 */
public static ActivationSystem getInstance(File folder, boolean cold)
{
  if (singleton2 == null)
    singleton2 = new ActivationSystemImpl(folder, cold);
  return singleton2;
}
项目:jvm-stm    文件:ActivationSystemImpl.java   
/**
 * Obtain the singleton instance of this class.
 * 
 * @param folder the folder, where the activation system will keep its files.
 * @param cold do the cold start if true, hot (usual) if false.
 */
public static ActivationSystem getInstance(File folder, boolean cold)
{
  if (singleton2 == null)
    singleton2 = new ActivationSystemImpl(folder, cold);
  return singleton2;
}
项目:infobip-open-jdk-8    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:jdk8u-dev-jdk    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:jdk7-jdk    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:openjdk-source-code-learn    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:OLD-OpenJDK8    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目: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);
    }
}
项目:JamVM-PH    文件:ActivationSystemImpl.java   
/**
 * Obtain the singleton instance of this class.
 * 
 * @param folder the folder, where the activation system will keep its files.
 * @param cold do the cold start if true, hot (usual) if false.
 */
public static ActivationSystem getInstance(File folder, boolean cold)
{
  if (singleton2 == null)
    singleton2 = new ActivationSystemImpl(folder, cold);
  return singleton2;
}
项目:openjdk-jdk7u-jdk    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:classpath    文件:ActivationSystemImpl.java   
/**
 * Obtain the singleton instance of this class.
 *
 * @param folder the folder, where the activation system will keep its files.
 * @param cold do the cold start if true, hot (usual) if false.
 */
public static ActivationSystem getInstance(File folder, boolean cold)
{
  if (singleton2 == null)
    singleton2 = new ActivationSystemImpl(folder, cold);
  return singleton2;
}
项目: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    文件: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    文件:ActivationGroupIDTest.java   
public void testEquals() throws ActivationException {
    ActivationSystem as = new MyActivationSystem();

    ActivationGroupID agid = new ActivationGroupID(as);
    ActivationGroupID agid2 = agid;
    ActivationGroupID agid3 = new ActivationGroupID(as);

    assertSame(agid2, agid);
    assertFalse(agid.equals(agid3));
}
项目:freeVM    文件:ActivationGroupIDTest.java   
public void testHashcode() throws ActivationException {
    ActivationSystem as = new MyActivationSystem();

    ActivationGroupID agid = new ActivationGroupID(as);
    ActivationGroupID agid3 = new ActivationGroupID(as);

    assertTrue(agid.hashCode() != agid3.hashCode());
}
项目:freeVM    文件:ActivationGroupIDTest.java   
public void testToString() throws ActivationException {
    ActivationSystem as = new MyActivationSystem();

    ActivationGroupID agid = new ActivationGroupID(as);
    ActivationGroupID agid3 = new ActivationGroupID(as);

    assertTrue(!agid.toString().equals(agid3.toString()));
}
项目:openjdk-icedtea7    文件:Activation.java   
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
项目:OpenJSharp    文件:Activation.java   
/**
 * Initialize the Activation instantiation; start activation
 * services.
 */
private void init(int port,
                  RMIServerSocketFactory ssf,
                  ReliableLog log,
                  String[] childArgs)
    throws Exception
{
    // initialize
    this.log = log;
    numUpdates = 0;
    shutdownHook =  new ShutdownHook();
    groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3);
    groupCounter = 0;
    Runtime.getRuntime().addShutdownHook(shutdownHook);

    // Use array size of 0, since the value from calling size()
    // may be out of date by the time toArray() is called.
    ActivationGroupID[] gids =
        groupTable.keySet().toArray(new ActivationGroupID[0]);

    synchronized (startupLock = new Object()) {
        // all the remote methods briefly synchronize on startupLock
        // (via checkShutdown) to make sure they don't happen in the
        // middle of this block.  This block must not cause any such
        // incoming remote calls to happen, or deadlock would result!
        activator = new ActivatorImpl(port, ssf);
        activatorStub = (Activator) RemoteObject.toStub(activator);
        system = new ActivationSystemImpl(port, ssf);
        systemStub = (ActivationSystem) RemoteObject.toStub(system);
        monitor = new ActivationMonitorImpl(port, ssf);
        initCommand(childArgs);
        registry = new SystemRegistryImpl(port, null, ssf, systemStub);

        if (ssf != null) {
            synchronized (initLock) {
                initDone = true;
                initLock.notifyAll();
            }
        }
    }
    startupLock = null;

    // restart services
    for (int i = gids.length; --i >= 0; ) {
        try {
            getGroupEntry(gids[i]).restartServices();
        } catch (UnknownGroupException e) {
            System.err.println(
                getTextResource("rmid.restart.group.warning"));
            e.printStackTrace();
        }
    }
}
项目:jdk8u-jdk    文件:Activation.java   
/**
 * Initialize the Activation instantiation; start activation
 * services.
 */
private void init(int port,
                  RMIServerSocketFactory ssf,
                  ReliableLog log,
                  String[] childArgs)
    throws Exception
{
    // initialize
    this.log = log;
    numUpdates = 0;
    shutdownHook =  new ShutdownHook();
    groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3);
    groupCounter = 0;
    Runtime.getRuntime().addShutdownHook(shutdownHook);

    // Use array size of 0, since the value from calling size()
    // may be out of date by the time toArray() is called.
    ActivationGroupID[] gids =
        groupTable.keySet().toArray(new ActivationGroupID[0]);

    synchronized (startupLock = new Object()) {
        // all the remote methods briefly synchronize on startupLock
        // (via checkShutdown) to make sure they don't happen in the
        // middle of this block.  This block must not cause any such
        // incoming remote calls to happen, or deadlock would result!
        activator = new ActivatorImpl(port, ssf);
        activatorStub = (Activator) RemoteObject.toStub(activator);
        system = new ActivationSystemImpl(port, ssf);
        systemStub = (ActivationSystem) RemoteObject.toStub(system);
        monitor = new ActivationMonitorImpl(port, ssf);
        initCommand(childArgs);
        registry = new SystemRegistryImpl(port, null, ssf, systemStub);

        if (ssf != null) {
            synchronized (initLock) {
                initDone = true;
                initLock.notifyAll();
            }
        }
    }
    startupLock = null;

    // restart services
    for (int i = gids.length; --i >= 0; ) {
        try {
            getGroupEntry(gids[i]).restartServices();
        } catch (UnknownGroupException e) {
            System.err.println(
                getTextResource("rmid.restart.group.warning"));
            e.printStackTrace();
        }
    }
}
项目: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    文件:Activation.java   
/**
 * Initialize the Activation instantiation; start activation
 * services.
 */
private void init(int port,
                  RMIServerSocketFactory ssf,
                  ReliableLog log,
                  String[] childArgs)
    throws Exception
{
    // initialize
    this.log = log;
    numUpdates = 0;
    shutdownHook =  new ShutdownHook();
    groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3);
    groupCounter = 0;
    Runtime.getRuntime().addShutdownHook(shutdownHook);

    // Use array size of 0, since the value from calling size()
    // may be out of date by the time toArray() is called.
    ActivationGroupID[] gids =
        groupTable.keySet().toArray(new ActivationGroupID[0]);

    synchronized (startupLock = new Object()) {
        // all the remote methods briefly synchronize on startupLock
        // (via checkShutdown) to make sure they don't happen in the
        // middle of this block.  This block must not cause any such
        // incoming remote calls to happen, or deadlock would result!
        activator = new ActivatorImpl(port, ssf);
        activatorStub = (Activator) RemoteObject.toStub(activator);
        system = new ActivationSystemImpl(port, ssf);
        systemStub = (ActivationSystem) RemoteObject.toStub(system);
        monitor = new ActivationMonitorImpl(port, ssf);
        initCommand(childArgs);
        registry = new SystemRegistryImpl(port, null, ssf, systemStub);

        if (ssf != null) {
            synchronized (initLock) {
                initDone = true;
                initLock.notifyAll();
            }
        }
    }
    startupLock = null;

    // restart services
    for (int i = gids.length; --i >= 0; ) {
        try {
            getGroupEntry(gids[i]).restartServices();
        } catch (UnknownGroupException e) {
            System.err.println(
                getTextResource("rmid.restart.group.warning"));
            e.printStackTrace();
        }
    }
}
项目: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();
        }
    }
}
项目:openjdk9    文件:Activation.java   
/**
 * Initialize the Activation instantiation; start activation
 * services.
 */
private void init(int port,
                  RMIServerSocketFactory ssf,
                  ReliableLog log,
                  String[] childArgs)
    throws Exception
{
    // initialize
    this.log = log;
    numUpdates = 0;
    shutdownHook =  new ShutdownHook();
    groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3);
    groupCounter = 0;
    Runtime.getRuntime().addShutdownHook(shutdownHook);

    // Use array size of 0, since the value from calling size()
    // may be out of date by the time toArray() is called.
    ActivationGroupID[] gids =
        groupTable.keySet().toArray(new ActivationGroupID[0]);

    synchronized (startupLock = new Object()) {
        // all the remote methods briefly synchronize on startupLock
        // (via checkShutdown) to make sure they don't happen in the
        // middle of this block.  This block must not cause any such
        // incoming remote calls to happen, or deadlock would result!
        activator = new ActivatorImpl(port, ssf);
        activatorStub = (Activator) RemoteObject.toStub(activator);
        system = new ActivationSystemImpl(port, ssf);
        systemStub = (ActivationSystem) RemoteObject.toStub(system);
        monitor = new ActivationMonitorImpl(port, ssf);
        initCommand(childArgs);
        registry = new SystemRegistryImpl(port, null, ssf, systemStub);

        if (ssf != null) {
            synchronized (initLock) {
                initDone = true;
                initLock.notifyAll();
            }
        }
    }
    startupLock = null;

    // restart services
    for (int i = gids.length; --i >= 0; ) {
        try {
            getGroupEntry(gids[i]).restartServices();
        } catch (UnknownGroupException e) {
            System.err.println(
                getTextResource("rmid.restart.group.warning"));
            e.printStackTrace();
        }
    }
}
项目: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();
        }
    }
}