java.rmi.activation.ActivationSystem Java Examples

The following examples show how to use java.rmi.activation.ActivationSystem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Activation.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #3
Source File: Activation.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #4
Source File: Activation.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #5
Source File: Activation.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #6
Source File: Activation.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    assert systemStub != null;
    synchronized (this) {
        this.systemStub = systemStub;
        notifyAll();
    }
}
 
Example #7
Source File: Activation.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #8
Source File: Activation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #9
Source File: Activation.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #10
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #11
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #12
Source File: Activation.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #13
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #14
Source File: Activation.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
SystemRegistryImpl(int port,
                   RMIClientSocketFactory csf,
                   RMIServerSocketFactory ssf,
                   ActivationSystem systemStub)
    throws RemoteException
{
    super(port, csf, ssf);
    this.systemStub = systemStub;
}
 
Example #15
Source File: Activation.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example #16
Source File: InheritedChannelNotServerSocket.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #17
Source File: InheritedChannelNotServerSocket.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #18
Source File: Activation.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example #19
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example #20
Source File: RmidViaInheritedChannel.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #21
Source File: RmidViaInheritedChannel.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #22
Source File: InheritedChannelNotServerSocket.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #23
Source File: Activation.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example #24
Source File: RmidViaInheritedChannel.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #25
Source File: InheritedChannelNotServerSocket.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #26
Source File: InheritedChannelNotServerSocket.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #27
Source File: Activation.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example #28
Source File: RmidViaInheritedChannel.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #29
Source File: RmidViaInheritedChannel.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}
 
Example #30
Source File: InheritedChannelNotServerSocket.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}