Package org.exolab.jms.net.registry

Examples of org.exolab.jms.net.registry.Registry.lookup()


            throw error;
        }

        RemoteJmsAdminServerIfc admin = null;
        try {
            admin = (RemoteJmsAdminServerIfc) registry.lookup("admin");
            _connection = admin.createConnection(username, password);
        } catch (NotBoundException exception) {
            throw new JMSException("Administration server is not bound in the registry for "
                    + "URL: " + url);
        } catch (RemoteException exception) {


            error.setLinkedException(exception);
            throw error;
        }

        try {
            factory = (ServerConnectionFactory) registry.lookup("server");
        } catch (NotBoundException exception) {
            throw new JMSException(
                    "Server is not bound in the registry for URL: "
                    + _serverURI);
        } catch (RemoteException exception) {

            throw error;
        }

        NamingProvider provider;
        try {
            provider = (NamingProvider) registry.lookup("jndi");
        } catch (NotBoundException exception) {
            throw new ServiceUnavailableException(
                    "JNDI service is not bound in the registry for URL: "
                    + url);
        } catch (RemoteException exception) {

        Proxy proxy = server.exportObject(serviceImpl);
        server.getRegistry().bind("service", proxy);

        ORB client = getClientORB();
        Registry registry = client.getRegistry(getConnectionProperties());
        CallbackService service = (CallbackService) registry.lookup("service");

        LoggingCallback callback = new LoggingCallback();
        Callback callbackProxy = (Callback) client.exportObjectTo(callback,
                                                                  getServerURI());
        service.addCallback(callbackProxy);

        ORB client = getClientORB();
        client.addCallerListener(getServerURI(), listener);

        Registry registry = getRegistry(); // will establish a connection
        assertNotNull(registry);
        CallbackService service = (CallbackService) registry.lookup("service");
        assertNotNull(service);

        // make sure the connection isn't reaped through inactivity
        // while there are proxies associated with it.
        for (int i = 0; i < 10; ++i) {

     *
     * @throws Exception for any error
     */
    public void testPrimitives() throws Exception {
        Registry registry = _orb.getRegistry(getConnectionProperties());
        EchoService echo = (EchoService) registry.lookup(ECHO_SERVICE);

        assertEquals(true, echo.echoBoolean(true));
        assertEquals(false, echo.echoBoolean(false));

        assertEquals(Byte.MIN_VALUE, echo.echoByte(Byte.MIN_VALUE));

     */
    public void testPrimitiveArrays() throws Exception {
        final int size = 4096;

        Registry registry = _orb.getRegistry(getConnectionProperties());
        EchoService echo = (EchoService) registry.lookup(ECHO_SERVICE);

        // byte arrays
        byte[] bytes = new byte[size];
        for (int i = 0; i < bytes.length; ++i) {
            bytes[i] = (byte) i;

     */
    public void testConcurrency() throws Exception {
        Thread[] threads = new Thread[10];

        Registry registry = _orb.getRegistry(getConnectionProperties());
        EchoService echo = (EchoService) registry.lookup(ECHO_SERVICE);

        for (int i = 0; i < threads.length; ++i) {
            threads[i] = new Thread(new IntInvoker(echo, i, 1000));
        }


        EchoServiceImpl impl = new EchoServiceImpl();
        Proxy proxy = orb.exportObject(impl);
        orb.getRegistry().bind("service", proxy);

        Registry registry = getRegistry(principal);
        EchoService service = (EchoService) registry.lookup("service");

        assertTrue(service.echoBoolean(true));

        checkUnexportObject(orb, impl, service);
    }

        EchoServiceImpl impl = new EchoServiceImpl();
        Proxy proxy = orb.exportObject(impl, getExportURI());
        orb.getRegistry().bind("service", proxy);

        Registry registry = getRegistry(principal);
        EchoService service = (EchoService) registry.lookup("service");

        assertTrue(service.echoBoolean(true));

        checkUnexportObject(orb, impl, service);
    }

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.